Tag Archives: parameters

Bash Positional Parameters

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

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

 $0 , $1 $2 $3 … parameters

These are special parameters and 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 : Shell argument 0, It expands into bash script file name or bash shell.

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

for example let’s create & execute the test script with some parameters :

Share