Changes

45 bytes added ,  01:30, 5 November 2009
no edit summary
Line 3: Line 3:  
|next=Export Variables|The export statement}}
 
|next=Export Variables|The export statement}}
   −
Your bash shell understand special characters with special meanings. For example, $var is used to display the variable value. Bash expands variables and [[wildcards]], for example:
+
Your bash shell understand special characters with special meanings. For example, $var is used to expand the variable value. Bash expands variables and [[wildcards]], for example:
<source lang="bash">echo $PATH
+
<source lang="bash">echo "$PATH"
echo $PS1
+
echo "$PS1"
 
echo /etc/*.conf</source>
 
echo /etc/*.conf</source>
However, sometime you do not wish to use variables or [[wildcards]]. For example, do not print value of $PATH, but just print $PATH on screen as a word. You can enable or disable the meaning of a special character by enclosing them into a single or double quotes. This is also useful to suppress warnings and error messages while writing the shell scripts.  
+
However, sometime you do not wish to use variables or [[wildcards]]. For example, do not print value of $PATH, but just print $PATH on screen as a word. You can enable or disable the meaning of a special character by enclosing them in single quotes. This is also useful to suppress warnings and error messages while writing the shell scripts.  
<source lang="bash">echo "Path is $PATH"</source>
+
<source lang="bash">echo "Path is $PATH" ## $PATH will be expanded</source>
 
OR
 
OR
<source lang="bash">echo 'I want to print $PATH'</source>
+
<source lang="bash">echo 'I want to print $PATH' ## PATH will not be expanded</source>
 
==Quoting==
 
==Quoting==
 
There are three types of quotes:
 
There are three types of quotes:
33

edits