Programming Tutorials

How to print or access value of user defined variables in Linux Shell Script

By: Vivek G. in Linux Tutorials on 2011-01-09  

To print or access UDV use following syntax

Syntax:

$variablename

Define variable vech and n as follows:

$ vech=Bus
$ n=10

To print contains of variable 'vech' type

$ echo $vech

It will print 'Bus',To print contains of variable 'n' type command as follows

$ echo $n

Caution: Do not try $ echo vech, as it will print vech instead its value 'Bus' and $ echo n, as it will print n instead its value '10', You must use $ followed by variable name.






Add Comment

* Required information
1000

Comments

No comments yet. Be the first!

Most Viewed Articles (in Linux )

Latest Articles (in Linux)