hello... Friends, Today we are going to discus about the variables in the shell programming variables have most important part in the shell programming. or we can say we can't count ,loop,or read input from the user or the environment.
Basically what is a variable ?
A variable is a memory chunks to which you can store arbitrary data, and retrieve it again, just by Referencing its name as we discus in previous post we use $ symbol in front of name of the variable.
How to assign Value to variables ?
Basically there are there ways of assigning the variables.
when we are not defining the variable and want to check the value the as shown in the exp. here we want to check the variable $undefine_var then it shows us a blank line. but if we define the value in the variable here nullport is a variable and it's value is Govind then as we click Enter then the value is store in the memory in the background & as we ask for the value of the variable by echo $nullport then it Display result as Govind which is the value we store in the variable.
Thanks for Reading . Please Leave your comments & Likes so that i can improve my quality.
Basically what is a variable ?
A variable is a memory chunks to which you can store arbitrary data, and retrieve it again, just by Referencing its name as we discus in previous post we use $ symbol in front of name of the variable.
How to assign Value to variables ?
Basically there are there ways of assigning the variables.
- Explicit definition : VAR=value
- Read : read VAR
- Command substitution : VAR=`date`,VAR=$(date)
Explicit definition
Read variable
Command substitution
what if we Don't define the variable ?when we are not defining the variable and want to check the value the as shown in the exp. here we want to check the variable $undefine_var then it shows us a blank line. but if we define the value in the variable here nullport is a variable and it's value is Govind then as we click Enter then the value is store in the memory in the background & as we ask for the value of the variable by echo $nullport then it Display result as Govind which is the value we store in the variable.
Thanks for Reading . Please Leave your comments & Likes so that i can improve my quality.
No comments:
Post a Comment