Test script test.sh

#! /bin/bash echo "Number of parameters passed to the script :$#" echo" The name of the script itself :$0" echo "first :$1" echo "second:$2" echo "is a list of all parameters passed to the script :$@" echo "PID of Shell itself :$$" echo" PID of Shell last run background Process :$!" Echo "all parameters :$*"Copy the code
$ sh  test.sh 11 22
Copy the code

You can see from the results:

$# is the number of arguments passed to the script

$0 is the name of the script itself

$1 is the first argument passed to the shell script

$2 is the second parameter passed to the shell script

$@ is a list of all the arguments passed to the script