How do you pass command line arguments in shell script?

Khánh Đoan

New member
How do you pass command line arguments in shell script?
Answer
Arguments can be passed to the script when it is executed, by writing them as a space-delimited list following the script file name. Inside the script, the $1 variable references the first argument in the command line, $2 the second argument and so forth. The variable $0 references to the current script.
 

Tìm kiếm

Back
Top