Linux

Variables in shell scripting

Variable is a place in memory where you can store your data like strings/texts and numbers in shell scripting. As the name suggest variable it is not fixed it's value can be changed depending on the information passed to the program.

Rules and conventions to create variable in shell scripting

Declaring variable in shell scripting

hello="hello viewers"
That's it. Now the variable hello is holding the string "hello viewers "

Accessing variables.

Note You can put semicolon after the variables and statements.It is optional.
Save this file and make it executable and run.

 #variable declaration

name="Welcome viewers"
number=56

#accessing/printing variable
#variables are accessed theought $ sign.
echo $name
echo $number;