Contents /
Previous /
Next
Command-Line Parameter
Command-Line Parameters (also called Command-Line Arguments)
can be reached with: $1, $2, etc.
$0 means the name of the program itself.
Example myfile.sh:
#!/bin/sh
echo " Progam name: $0
The first argument is: $1,
second argument is: $2, third
argument is: $3"
This can be run with: myfile.sh dogs cats birds
Test for a special option, example:
if test "$1" = "--special" ; then
shift
myprog2.sh "$@"
fi