Shell Scripting Class 2 Variable tips you need to learn
We will learn shell scripting class 2, To create a variable, put a line in your script that contains the name of the variable followed immediately by an equal sign (“=”). No spaces are allowed. After the equal sign, assign the information you wish to store in variable.
Shell scripting Class 2 Variable rules
- Names must start with a letter special characters are not allowed.
- Spaces are not allowed you have to use underscore in place of space.
- You cannot use punctuation marks.
Variables in Shell Shell Scripting Class 2
To process our data/information, data must be kept in computers RAM memory. RAM memory is divided into small locations, and each location had unique number called memory location/address, which is used to hold our data. Programmer can give a unique name to this memory location/address called memory variable or variable (Its a named storage location that may take different values, but only one at a time).
In Linux (Shell), there are two types of variable:
- System variables – Created and maintained by Linux itself. This type of variable defined in CAPITAL LETTERS.
- User defined variables (UDV) – Created and maintained by user. This type of variable defined in lower letters.
[root@Techtutorials ~]# sh variable.sh What is Your Name..?? [root@Techtutorials ~]# cat variable.sh #!/bin/bash ## Shell Scripting Variable WIYN="What is Your Name..??" echo "$WIYN"
your feedback is valuable to us…