Arithmetic Operators | Shell Scripting Beginners Tutorial-34

Arithmetic operators :-



+ addition



- substraction



\* multiplication



/ division



% modulo division (it gives remainder)



eg:-



5 % 2 = 1 (remainder)



5 / 2 = 2


Special Variables | Shell Scripting Tutorial For Beginners-32

$* it stores the complete set of positional parameters as a single string



$# It is set to the number of arguments specified



$1 first argument



$2 second argument



$0 name of executed command



"$@" each quoted string treated as a seperate argument



$? exit status of last command



$$ PID of the current shell



$! PID of the last background job

Variables | Shell Scripting Tutorial for Beginners-31

Variables are used to store information to be referenced and manipulated in a computer program. They also provide a way of labeling data with a descriptive name, so our programs can be understood more clearly by the reader and ourselves. It is helpful to think of variables as containers that hold information. Their sole purpose is to label and store data in memory. This data can then be used throughout your program.