-->

Variables in shell scripting

Now let's discuss some variables in ShellScripting


what is variable


Basically variable is a place located in memory . which is used to store your data like strings/texts and numbers in shell scripting. 


Where Variable means it's not a permanent value can be changed according to process of the programme . 

For example If you installed Candy crush game in your device.At First time you are opening the Score shows 000.After playing level score score might rises to 736.This data will be stored in variables format.


Rules to Create Variables in Shell Scripting

Where variable name should starts with character/without a character .Then the variable becomes valid else it doesn't works.

_name="my name is kumar"
or like below one variable works fine
name="my name is abc"

Where variable name shouldn't starts with number 
Name1=" My name is kumar"

is valid variable and
1name="My name is kumar"
is an invalid variable.

Doing a minor mistake in Variables Bash interpreter gives a difference result in shell scripting 

using lower case
 name="first"
using upper case
 NAME="last"

You should not use any blank spaces and Comma's in shell scripting.Then total code fails to work.

Lets Declaring some variables in shell scripting
hello="hello viewers"
it means the variable hello is holding the string "hello viewers "

conclusion


I hope you may loved this cool post.If you have any doubts post in comment section.
Please check out advertisements on our website which helps us to post more content for you .
 Don't forget to share this cool post with all your friends and groupspread. HAVE  A  GREAT  DAY. 

Also Read

Post a Comment