The Command Line
Accessing
-
- Two variables provide access to command line arguments
- The variable $0
contains the command name
- The variable @ARGV
contains the argument list
- The command line "myScript -a -f file
-c" yields
Variable |
Contains |
$0 |
myScript |
$ARGV[0] |
-a |
$ARGV[1] |
-f |
$ARGV[2] |
file |
$ARGV[3] |
-c |
- Note: In "C" the "argv" array includes the command name in argv[0]