This article or section is in a state of significant expansion or restructuring. You are welcome to assist in its construction by editing it as well. If this article or section has not been edited in several days, please remove this template. If you are the editor who added this template and you are actively editing, please be sure to replace this template with {{in use}} during the active editing session. Click on the link for template parameters to use.
This article was last edited by Tisane (talk | contribs) 15 years ago. (Update timer) |
Different Command-line argument parsing methods are used by different programming languages to parse command-line arguments.
Programming languages
C
C uses argv
to process command-line arguments.[1]
Java
An example of Java argument parsing would be:
public class Echo {
public static void main (String[] args) {
for (String s: args) {
System.out.println(s);
}
}
}
Perl
Perl uses $ARGV
.
PHP
PHP uses argc
as a count of arguments and argv
as an array containing the values of the arguments.[2] For example:
var_dump($argv);
Python
Python uses sys.argv
, e.g.:
for arg in sys.argv:
print arg