UNIX Shell Scripting - Command Line Arguments
You can pass variables while executing the script.
The command line arguments are numbered from $0 to $9, where $0 is the name of the script itself and $1 to $9 are first to ninth argument respectively. You can use more arguments by refering them as ${nn}.
You can use shift command to shift the arguments to left. This is useful when you want to scan through the arguments.
The following additional variables are defined apart from the command line arguments:
$# refers to the number of arguments passed
$@ refers to all the argumets as a string
$- refers to flags called
$$ refers to the PID of shell
The command line arguments are numbered from $0 to $9, where $0 is the name of the script itself and $1 to $9 are first to ninth argument respectively. You can use more arguments by refering them as ${nn}.
You can use shift command to shift the arguments to left. This is useful when you want to scan through the arguments.
The following additional variables are defined apart from the command line arguments:
$# refers to the number of arguments passed
$@ refers to all the argumets as a string
$- refers to flags called
$$ refers to the PID of shell
so good
ReplyDeletethank you for a hard work...
Ashraf, Glad to know you found the post useful!
ReplyDelete