Shell Scripting Variables

Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

Shell Scripting Variables

Scripts can contain variables inside the script.

Linux Shell Scripting Variables 1

Look at the above snapshot, two variables are assigned to the script $var1 and $var2.

As scripts run in their own shell, hence variables do not survive the end of the script.

Linux Shell Scripting Variables 2

Look at the above snapshot, var1 and var2 do not run outside the script.