Tag Archives: parameters

Bash Positional Parameters, Arguments

Bash Shell has several special positional parameters which can be referenced but can not be assigned. These bash parameters are used to process command line arguments in a bash shell script, to get process status, exit status and options flag.

These bash positional parameters can be assigned to a variable and values can be used for further processing.

 $0 , $1 $2 $3 … bash Parameters

These are special parameters and has specific meaning according to the number.  These parameters are useful if you want to validate executing file name and do the processing based on the arguments.

$0 : bash Shell argument 0, It expands into bash script file name or bash shell.

$1 $2 $3 …   : bash shell argument number : Used to get the specific argument from the script.

for example let’s create & execute the test script with some parameters and note the bash arguments supplied as parameters :