Practice 1
The following shell program display how to implement the positional parameters.
# cat > pscript
echo "The command is $0"
echo "The First argument is $1"
echo "The Second argument is $1"
echo "The Third argument is $1"
echo "The Fourth argument is $1"
# chmod u + x pscript
#./ pscript a b c d
The command is pscript
The First argument is a
The Second argument is b
The Third argument is c
The Fourth argument is d
In the given program, the pscript (filename) is $0 and the parameters are a, b, c and d are represented by $0,$1,$2 and $3 correspondingly.