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.

 

https://www.youtube.com/watch?v=_ofWOLO5JV0

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:

  1. System variables – Created and maintained by Linux itself. This type of variable defined in CAPITAL LETTERS.
  2. User defined variables (UDV) – Created and maintained by user. This type of variable defined in lower letters.

Variable Example

[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…

Related Articles

What is shell scripting

Bash Scripting

What is shell and shell scripting

Print given range of lines using awk, perl and python

Thanks for your wonderful Support and Encouragement

Ankam Ravi Kumar

Working as Linux / Storage Administrator L3. Interested in sharing the knowledge.

2 Responses

  1. arjun says:

    unable to access the video

  2. Saket says:

    if you can share your full tutorial video i can view using VLC player

Leave a Reply

Your email address will not be published. Required fields are marked *