29.1 Command line arguments variables ¶
The following global variables are defined by default.
- Variable: ARGV1 ¶
An array containing all the command line arguments. When no command line arguments are present: this array is empty. The indexes in this array are zero–based.
- Variable: ARGC1 ¶
A non–negative integer representing the number of values in
ARGV1
. When no command line arguments are present: this variable is set to zero.
- Variable: ARG1ST ¶
A non–negative integer representing the index in
ARGV1
of the next argument to be processed. It is initialised to zero; theactions
module increments it to reflect its consuming of action arguments; thegetopts
module uses this value to locate the first argument to parse.
- Variable: ARGV ¶
An array containing all the non–action and non–option command line arguments. When no such arguments are present: this array is empty. This variable is filled by the
getopts
module. The indexes in this array are zero–based.Remembering the Bash syntax for arrays, we can expand the array to all its items with:
"${ARGV[@]}"
- Variable: ARGC ¶
A non–negative integer representing the number of values in
ARGV
. When no arguments are present: this variable is set to zero.