Variable are used to take most out of data and shell.few variables are used to access data provided to shell during execution with file.$0,$1, $2, $3,...,$9 are variables accessed by script to get data that is passed to file before execution. $0 is the filename and after that all other variables follow tha dat provided.
ex : if passed ./file.sh i am new variable then
$0 : file.sh, $1 : i, $2 : am ....so on till $9 .
Now problem that can be that what if data is more than 9, then `shift` keyword is used to shift the pointer of the shell variable to read further.
In this example `shift 2` line shifts the pointer two forward and $1 becomes the third word beacuse of 2 shifts.
$$ : PID of current shell
$? : Exit status of last executed background
$! : PID of last baskground process
$- : Current shell settings
$# : Total number of positional parameter
$0 : Name of command being executed
$* : List of shell argument
$@ : Similar to $* but yields each arguments separately enclosed in double quotes
Readonly keyword before variable makes variable explicity readable only. It cannot be modified. If tried to modified it creates error.
Variable once defined if needed can be removed from script by `unset` keyword. If accesssed again without declaring again will give blank.