next up previous contents
Next: Passing in Arguments Up: Shell Programming Previous: .chsrc   Contents


Strings

There are 3 types of strings:-

Double quoted strings
Double quoted strings are treated as literals i.e. just a set of characters except any variables are replaced by their values. For example:-

var="abc"
echo "var = $var"
produces:-
var = abc

Single quoted strings
Single quoted strings are treated as literals i.e. just a set of characters and variables are not replaced by their values. For example:-

var="abc"
echo 'var = $var'
produces:-
var = $var

Back quoted strings
The contents of a back quoted string are executed as a command and the output from it is returned as the value of the string. For example:-

var=`hostname`
echo "var = $var"
produces:-
var = pplxint9
if run on PPLXINT9.



P.D. Gronbech (IT Staff) 2015-10-02