Changes

Jump to navigation Jump to search
1,030 bytes added ,  16:39, 19 October 2009
Line 36: Line 36:  
|}
 
|}
   −
==Backslash==
+
==The Backslash==
 
The backslash ( \ ) alters the special meaning of the ' and " i.e. it will escape or cancel the special meaning of the next character. The following will display filename in double quote:
 
The backslash ( \ ) alters the special meaning of the ' and " i.e. it will escape or cancel the special meaning of the next character. The following will display filename in double quote:
 
<source lang="bash">FILE="/etc/resolv.conf"
 
<source lang="bash">FILE="/etc/resolv.conf"
Line 47: Line 47:  
Sample Outputs:
 
Sample Outputs:
 
<pre>File is $FILE </pre>
 
<pre>File is $FILE </pre>
 
+
===The backslash-escaped characters===
 +
You can use the following backslash-escaped characters. It will get replaced as specified by the ANSI C standard. Quoting directly from bash man page:
 +
<pre>
 +
              \a    alert (bell)
 +
              \b    backspace
 +
              \e    an escape character
 +
              \f    form feed
 +
              \n    new line
 +
              \r    carriage return
 +
              \t    horizontal tab
 +
              \v    vertical tab
 +
              \\    backslash
 +
              \'    single quote
 +
              \nnn  the eight-bit character whose value is the octal value nnn (one to three digits)
 +
              \xHH  the eight-bit character whose value is the hexadecimal value HH (one or two hex digits)
 +
              \cx    a control-x character
 +
</pre>
 +
===Examples===
 +
<source lang="bash">echo -e "\a Ding dong\a"
 +
echo "CIFS path must be \\\\NT-Server-Name\\ShareName"
 +
echo -e "Sr.no\t DVD (price) "
 +
echo -e "1\t Spirited Away (INR.200)"
 +
echo -e "2\t Dragon Ball Z (INR.300)"</source>
 
[[Category:Variables and Quoting]]
 
[[Category:Variables and Quoting]]
 
{{navigation
 
{{navigation
 
|previous=Echo Command|Display the value of shell variables
 
|previous=Echo Command|Display the value of shell variables
 
|next=Export Variables|The export statement}}
 
|next=Export Variables|The export statement}}

Navigation menu