<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>WiredRevolution.com &#187; shell</title>
	<atom:link href="http://www.wiredrevolution.com/tag/shell/feed" rel="self" type="application/rss+xml" />
	<link>http://www.wiredrevolution.com</link>
	<description>A Bit of Linux Wisdom</description>
	<lastBuildDate>Wed, 18 Jan 2012 22:45:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Find the exit status of a previous command in Bash</title>
		<link>http://www.wiredrevolution.com/bash-programming/find-the-exit-status-of-a-previous-command-in-bash?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=find-the-exit-status-of-a-previous-command-in-bash</link>
		<comments>http://www.wiredrevolution.com/bash-programming/find-the-exit-status-of-a-previous-command-in-bash#comments</comments>
		<pubDate>Fri, 14 Jan 2011 17:30:01 +0000</pubDate>
		<dc:creator>Ryan</dc:creator>
				<category><![CDATA[bash]]></category>
		<category><![CDATA[$?]]></category>
		<category><![CDATA[access]]></category>
		<category><![CDATA[command]]></category>
		<category><![CDATA[find]]></category>
		<category><![CDATA[print]]></category>
		<category><![CDATA[return]]></category>
		<category><![CDATA[return code]]></category>
		<category><![CDATA[return statis]]></category>
		<category><![CDATA[return value]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[statis]]></category>
		<category><![CDATA[variable]]></category>

		<guid isPermaLink="false">http://www.wiredrevolution.com/?p=1464</guid>
		<description><![CDATA[<img src="http://www.wiredrevolution.com/wp-content/uploads/bash_icon.png" width="80" height="34" alt="" title="bash" /><br/>Most programs will return an exit status of 0 if the program was successful, while a non-zero exit status usually indicates an error. You can find the exit status or exit code of the previously executed command by accessing the &#8220;$?&#8221; shell variable. $ COMMAND $ echo $? Typically when a command terminates on a [...]


Related posts<ol><li><a href='http://www.wiredrevolution.com/bash-programming/find-the-pid-of-a-background-child-process-in-bash' rel='bookmark' title='Permanent Link: Find the PID of a background child process in Bash'>Find the PID of a background child process in Bash</a></li>
<li><a href='http://www.wiredrevolution.com/bash-programming/find-the-pid-of-the-current-bash-script' rel='bookmark' title='Permanent Link: Find the PID of the current Bash script'>Find the PID of the current Bash script</a></li>
<li><a href='http://www.wiredrevolution.com/bash-programming/find-the-parent-pid-of-a-bash-script' rel='bookmark' title='Permanent Link: Find the parent PID of a Bash Script'>Find the parent PID of a Bash Script</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<img src="http://www.wiredrevolution.com/wp-content/uploads/bash_icon.png" width="80" height="34" alt="" title="bash" /><br/><p>Most programs will return an exit status of 0 if the program was successful, while a non-zero exit status usually indicates an error. You can find the exit status or exit code of the previously executed command by accessing the &#8220;<strong>$?</strong>&#8221; shell variable.</p>
<p><code>$ COMMAND<br />
$ echo $?</code></p>
<p>Typically when a command terminates on a fatal signal whose number is N, Bash uses the value 128+N as the exit status. If a command is not found, the child process created to execute it returns a status of 127. If a command is found but is not executable, the return status is 126.</p>
<p>You can also use the exit status in a conditional.</p>
<p><code>#!/bin/bash<br />
COMMAND<br />
STATUS=$?<br />
if [ $STATUS -eq 0 ]; then<br />
   echo "Command Successful"<br />
else<br />
   echo "Command Failed"<br />
fi</code></p>


<p>Related posts<ol><li><a href='http://www.wiredrevolution.com/bash-programming/find-the-pid-of-a-background-child-process-in-bash' rel='bookmark' title='Permanent Link: Find the PID of a background child process in Bash'>Find the PID of a background child process in Bash</a></li>
<li><a href='http://www.wiredrevolution.com/bash-programming/find-the-pid-of-the-current-bash-script' rel='bookmark' title='Permanent Link: Find the PID of the current Bash script'>Find the PID of the current Bash script</a></li>
<li><a href='http://www.wiredrevolution.com/bash-programming/find-the-parent-pid-of-a-bash-script' rel='bookmark' title='Permanent Link: Find the parent PID of a Bash Script'>Find the parent PID of a Bash Script</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.wiredrevolution.com/bash-programming/find-the-exit-status-of-a-previous-command-in-bash/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Find the parent PID of a Bash Script</title>
		<link>http://www.wiredrevolution.com/bash-programming/find-the-parent-pid-of-a-bash-script?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=find-the-parent-pid-of-a-bash-script</link>
		<comments>http://www.wiredrevolution.com/bash-programming/find-the-parent-pid-of-a-bash-script#comments</comments>
		<pubDate>Sun, 09 Jan 2011 17:53:03 +0000</pubDate>
		<dc:creator>Ryan</dc:creator>
				<category><![CDATA[bash]]></category>
		<category><![CDATA[$PPID]]></category>
		<category><![CDATA[access]]></category>
		<category><![CDATA[child]]></category>
		<category><![CDATA[find]]></category>
		<category><![CDATA[parent]]></category>
		<category><![CDATA[PID]]></category>
		<category><![CDATA[print]]></category>
		<category><![CDATA[process]]></category>
		<category><![CDATA[process ID]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[variable]]></category>

		<guid isPermaLink="false">http://www.wiredrevolution.com/?p=1449</guid>
		<description><![CDATA[<img src="http://www.wiredrevolution.com/wp-content/uploads/bash_icon.png" width="80" height="34" alt="" title="bash" /><br/>For any number of reasons you may want to know the parent process ID of the current Bash script. You can find the parent process of the current Bash script or shell by printing the &#8216;$PPID&#8216; shell variable. $ echo $PPID20341 Related postsFind the PID of the current Bash script Find the PID of a [...]


Related posts<ol><li><a href='http://www.wiredrevolution.com/bash-programming/find-the-pid-of-the-current-bash-script' rel='bookmark' title='Permanent Link: Find the PID of the current Bash script'>Find the PID of the current Bash script</a></li>
<li><a href='http://www.wiredrevolution.com/bash-programming/find-the-pid-of-a-background-child-process-in-bash' rel='bookmark' title='Permanent Link: Find the PID of a background child process in Bash'>Find the PID of a background child process in Bash</a></li>
<li><a href='http://www.wiredrevolution.com/bash-programming/find-the-exit-status-of-a-previous-command-in-bash' rel='bookmark' title='Permanent Link: Find the exit status of a previous command in Bash'>Find the exit status of a previous command in Bash</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<img src="http://www.wiredrevolution.com/wp-content/uploads/bash_icon.png" width="80" height="34" alt="" title="bash" /><br/><p>For any number of reasons you may want to know the parent process ID of the current Bash script. You can find the parent process of the current Bash script or shell by printing the &#8216;<strong>$PPID</strong>&#8216; shell variable.</p>
<p><code>$ echo $PPID</code><code>20341</code></p>


<p>Related posts<ol><li><a href='http://www.wiredrevolution.com/bash-programming/find-the-pid-of-the-current-bash-script' rel='bookmark' title='Permanent Link: Find the PID of the current Bash script'>Find the PID of the current Bash script</a></li>
<li><a href='http://www.wiredrevolution.com/bash-programming/find-the-pid-of-a-background-child-process-in-bash' rel='bookmark' title='Permanent Link: Find the PID of a background child process in Bash'>Find the PID of a background child process in Bash</a></li>
<li><a href='http://www.wiredrevolution.com/bash-programming/find-the-exit-status-of-a-previous-command-in-bash' rel='bookmark' title='Permanent Link: Find the exit status of a previous command in Bash'>Find the exit status of a previous command in Bash</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.wiredrevolution.com/bash-programming/find-the-parent-pid-of-a-bash-script/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Find the PID of a background child process in Bash</title>
		<link>http://www.wiredrevolution.com/bash-programming/find-the-pid-of-a-background-child-process-in-bash?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=find-the-pid-of-a-background-child-process-in-bash</link>
		<comments>http://www.wiredrevolution.com/bash-programming/find-the-pid-of-a-background-child-process-in-bash#comments</comments>
		<pubDate>Sun, 09 Jan 2011 17:47:57 +0000</pubDate>
		<dc:creator>Ryan</dc:creator>
				<category><![CDATA[bash]]></category>
		<category><![CDATA[$!]]></category>
		<category><![CDATA[access]]></category>
		<category><![CDATA[background]]></category>
		<category><![CDATA[child]]></category>
		<category><![CDATA[PID]]></category>
		<category><![CDATA[print]]></category>
		<category><![CDATA[process]]></category>
		<category><![CDATA[process ID]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[variable]]></category>
		<category><![CDATA[view]]></category>

		<guid isPermaLink="false">http://www.wiredrevolution.com/?p=1441</guid>
		<description><![CDATA[<img src="http://www.wiredrevolution.com/wp-content/uploads/bash_icon.png" width="80" height="34" alt="" title="bash" /><br/>In order to control or monitor background child processes from a shell script you will need to know the PID of the child. Bash stores the PID of the last process executed in the &#8220;$!&#8221; shell variable. If you start a background process in an interactive shell it will output the PID of the child. [...]


Related posts<ol><li><a href='http://www.wiredrevolution.com/bash-programming/find-the-pid-of-the-current-bash-script' rel='bookmark' title='Permanent Link: Find the PID of the current Bash script'>Find the PID of the current Bash script</a></li>
<li><a href='http://www.wiredrevolution.com/bash-programming/find-the-parent-pid-of-a-bash-script' rel='bookmark' title='Permanent Link: Find the parent PID of a Bash Script'>Find the parent PID of a Bash Script</a></li>
<li><a href='http://www.wiredrevolution.com/bash-programming/find-the-exit-status-of-a-previous-command-in-bash' rel='bookmark' title='Permanent Link: Find the exit status of a previous command in Bash'>Find the exit status of a previous command in Bash</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<img src="http://www.wiredrevolution.com/wp-content/uploads/bash_icon.png" width="80" height="34" alt="" title="bash" /><br/><p>In order to control or monitor background child processes from a shell script you will need to know the PID of the child. Bash stores the PID of the last process executed in the &#8220;$!&#8221; shell variable.</p>
<p>If you start a background process in an interactive shell it will output the PID of the child.<br />
<code>$ sleep 1 &#038;</code><code>[1]20450</code></p>
<p>Since thee PID of the last command set to run in the background by the current shell or script is stored in &#8216;<strong>$!</strong>&#8216; variable, you can simply echo this variable to print the PID of the previous sleep command.<br />
<code>$ echo $!</code><code>20450</code></p>


<p>Related posts<ol><li><a href='http://www.wiredrevolution.com/bash-programming/find-the-pid-of-the-current-bash-script' rel='bookmark' title='Permanent Link: Find the PID of the current Bash script'>Find the PID of the current Bash script</a></li>
<li><a href='http://www.wiredrevolution.com/bash-programming/find-the-parent-pid-of-a-bash-script' rel='bookmark' title='Permanent Link: Find the parent PID of a Bash Script'>Find the parent PID of a Bash Script</a></li>
<li><a href='http://www.wiredrevolution.com/bash-programming/find-the-exit-status-of-a-previous-command-in-bash' rel='bookmark' title='Permanent Link: Find the exit status of a previous command in Bash'>Find the exit status of a previous command in Bash</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.wiredrevolution.com/bash-programming/find-the-pid-of-a-background-child-process-in-bash/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Find the PID of the current Bash script</title>
		<link>http://www.wiredrevolution.com/bash-programming/find-the-pid-of-the-current-bash-script?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=find-the-pid-of-the-current-bash-script</link>
		<comments>http://www.wiredrevolution.com/bash-programming/find-the-pid-of-the-current-bash-script#comments</comments>
		<pubDate>Sun, 09 Jan 2011 17:18:51 +0000</pubDate>
		<dc:creator>Ryan</dc:creator>
				<category><![CDATA[bash]]></category>
		<category><![CDATA[$$]]></category>
		<category><![CDATA[access]]></category>
		<category><![CDATA[current]]></category>
		<category><![CDATA[environment variable]]></category>
		<category><![CDATA[find]]></category>
		<category><![CDATA[PID]]></category>
		<category><![CDATA[print]]></category>
		<category><![CDATA[process ID]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[variable]]></category>

		<guid isPermaLink="false">http://www.wiredrevolution.com/?p=1438</guid>
		<description><![CDATA[<img src="http://www.wiredrevolution.com/wp-content/uploads/bash_icon.png" width="80" height="34" alt="" title="bash" /><br/>In many cases you will need to determine the PID of a current Bash script or shell. Bash stores a specific variable that allows you to view the process ID of the current shell &#8220;$$&#8216;. You can echo the $$ to print the current PID. $ echo $$23490 Related postsFind the parent PID of a [...]


Related posts<ol><li><a href='http://www.wiredrevolution.com/bash-programming/find-the-parent-pid-of-a-bash-script' rel='bookmark' title='Permanent Link: Find the parent PID of a Bash Script'>Find the parent PID of a Bash Script</a></li>
<li><a href='http://www.wiredrevolution.com/bash-programming/find-the-pid-of-a-background-child-process-in-bash' rel='bookmark' title='Permanent Link: Find the PID of a background child process in Bash'>Find the PID of a background child process in Bash</a></li>
<li><a href='http://www.wiredrevolution.com/bash-programming/find-the-exit-status-of-a-previous-command-in-bash' rel='bookmark' title='Permanent Link: Find the exit status of a previous command in Bash'>Find the exit status of a previous command in Bash</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<img src="http://www.wiredrevolution.com/wp-content/uploads/bash_icon.png" width="80" height="34" alt="" title="bash" /><br/><p>In many cases you will need to determine the PID of a current Bash script or shell. Bash stores a specific variable that allows you to view the process ID of the current shell &#8220;<strong>$$</strong>&#8216;.</p>
<p>You can echo the $$ to print the current PID.<br />
<code>$ echo $$</code><code>23490</code></p>


<p>Related posts<ol><li><a href='http://www.wiredrevolution.com/bash-programming/find-the-parent-pid-of-a-bash-script' rel='bookmark' title='Permanent Link: Find the parent PID of a Bash Script'>Find the parent PID of a Bash Script</a></li>
<li><a href='http://www.wiredrevolution.com/bash-programming/find-the-pid-of-a-background-child-process-in-bash' rel='bookmark' title='Permanent Link: Find the PID of a background child process in Bash'>Find the PID of a background child process in Bash</a></li>
<li><a href='http://www.wiredrevolution.com/bash-programming/find-the-exit-status-of-a-previous-command-in-bash' rel='bookmark' title='Permanent Link: Find the exit status of a previous command in Bash'>Find the exit status of a previous command in Bash</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.wiredrevolution.com/bash-programming/find-the-pid-of-the-current-bash-script/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Convert a relative path to absolute path in BASH</title>
		<link>http://www.wiredrevolution.com/bash-programming/convert-a-relative-path-to-absolute-path-in-bash?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=convert-a-relative-path-to-absolute-path-in-bash</link>
		<comments>http://www.wiredrevolution.com/bash-programming/convert-a-relative-path-to-absolute-path-in-bash#comments</comments>
		<pubDate>Fri, 01 Oct 2010 15:11:41 +0000</pubDate>
		<dc:creator>Ryan</dc:creator>
				<category><![CDATA[bash]]></category>
		<category><![CDATA[absolute]]></category>
		<category><![CDATA[canonicalize]]></category>
		<category><![CDATA[convert]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[path]]></category>
		<category><![CDATA[pathname]]></category>
		<category><![CDATA[readlink]]></category>
		<category><![CDATA[realpath]]></category>
		<category><![CDATA[relative]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.wiredrevolution.com/?p=1294</guid>
		<description><![CDATA[<img src="http://www.wiredrevolution.com/wp-content/uploads/bash_icon.png" width="80" height="34" alt="" title="bash" /><br/>There are a few ways to take a relative path and convert it to an absolute path which can be accessed regardless of the current working directory. The easiest method is to use the readlink utility which comes bundled with about every distribution. Here my working directory is my home directory. It is printed as [...]


Related posts<ol><li><a href='http://www.wiredrevolution.com/bash-programming/have-a-bash-script-determine-its-own-location' rel='bookmark' title='Permanent Link: Have a Bash script determine it&#8217;s own location'>Have a Bash script determine it&#8217;s own location</a></li>
<li><a href='http://www.wiredrevolution.com/bash-programming/convert-text-files-within-a-directory-from-windows-to-unix-format' rel='bookmark' title='Permanent Link: Convert text files within a directory from Windows to Unix format'>Convert text files within a directory from Windows to Unix format</a></li>
<li><a href='http://www.wiredrevolution.com/commands/using-tar-to-archive-files' rel='bookmark' title='Permanent Link: Using tar to archive files'>Using tar to archive files</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<img src="http://www.wiredrevolution.com/wp-content/uploads/bash_icon.png" width="80" height="34" alt="" title="bash" /><br/><p>There are a few ways to take a relative path and convert it to an absolute path which can be accessed regardless of the current working directory. The easiest method is to use the <strong>readlink</strong> utility which comes bundled with about every distribution.</p>
<p>Here my working directory is my home directory. It is printed as an absolute path.<br />
<code>$ pwd</code><code>/home/ryan</code></p>
<p>Using readlink we can convert this same directory as a relative path to an absolute path.<br />
<code>$ readlink -f ./../ryan/Desktop/../../../home/ryan</code><code>/home/ryan</code></p>
<p>If you are using a Debian based distribution like Ubuntu you can use the <strong>realpath</strong> utility instead.<br />
<code>$ realpath ./../ryan/Desktop/../../../home/ryan</code><code>/home/ryan</code></p>


<p>Related posts<ol><li><a href='http://www.wiredrevolution.com/bash-programming/have-a-bash-script-determine-its-own-location' rel='bookmark' title='Permanent Link: Have a Bash script determine it&#8217;s own location'>Have a Bash script determine it&#8217;s own location</a></li>
<li><a href='http://www.wiredrevolution.com/bash-programming/convert-text-files-within-a-directory-from-windows-to-unix-format' rel='bookmark' title='Permanent Link: Convert text files within a directory from Windows to Unix format'>Convert text files within a directory from Windows to Unix format</a></li>
<li><a href='http://www.wiredrevolution.com/commands/using-tar-to-archive-files' rel='bookmark' title='Permanent Link: Using tar to archive files'>Using tar to archive files</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.wiredrevolution.com/bash-programming/convert-a-relative-path-to-absolute-path-in-bash/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Multiple line comments in BASH</title>
		<link>http://www.wiredrevolution.com/bash-programming/multiple-line-comments-in-bash?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=multiple-line-comments-in-bash</link>
		<comments>http://www.wiredrevolution.com/bash-programming/multiple-line-comments-in-bash#comments</comments>
		<pubDate>Wed, 29 Sep 2010 18:53:03 +0000</pubDate>
		<dc:creator>Ryan</dc:creator>
				<category><![CDATA[bash]]></category>
		<category><![CDATA[block]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[comment]]></category>
		<category><![CDATA[comments]]></category>
		<category><![CDATA[here document]]></category>
		<category><![CDATA[line]]></category>
		<category><![CDATA[multi]]></category>
		<category><![CDATA[multi-line]]></category>
		<category><![CDATA[multiple]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://www.wiredrevolution.com/?p=1291</guid>
		<description><![CDATA[<img src="http://www.wiredrevolution.com/wp-content/uploads/bash_icon.png" width="80" height="34" alt="" title="bash" /><br/>Comments are done in BASH and most other shells by placing a &#8216;#&#8217; mark at the beginning of a line. To create a multi-line comment, or to comment out an entire block of code, you can use the following HERE DOCUMENT feature. :


Related posts<ol><li><a href='http://www.wiredrevolution.com/bash-programming/find-the-pid-of-the-current-bash-script' rel='bookmark' title='Permanent Link: Find the PID of the current Bash script'>Find the PID of the current Bash script</a></li>
<li><a href='http://www.wiredrevolution.com/bash-programming/find-the-parent-pid-of-a-bash-script' rel='bookmark' title='Permanent Link: Find the parent PID of a Bash Script'>Find the parent PID of a Bash Script</a></li>
<li><a href='http://www.wiredrevolution.com/bash-programming/find-the-exit-status-of-a-previous-command-in-bash' rel='bookmark' title='Permanent Link: Find the exit status of a previous command in Bash'>Find the exit status of a previous command in Bash</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<img src="http://www.wiredrevolution.com/wp-content/uploads/bash_icon.png" width="80" height="34" alt="" title="bash" /><br/><p>Comments are done in BASH and most other shells by placing a &#8216;#&#8217; mark at the beginning of a line. To create a multi-line comment, or to comment out an entire block of code, you can use the following HERE DOCUMENT feature.</p>
<p><code>: << '--COMMENT--'<br />
comment line 1<br />
comment line 2<br />
comment line n<br />
--COMMENT--</code></p>


<p>Related posts<ol><li><a href='http://www.wiredrevolution.com/bash-programming/find-the-pid-of-the-current-bash-script' rel='bookmark' title='Permanent Link: Find the PID of the current Bash script'>Find the PID of the current Bash script</a></li>
<li><a href='http://www.wiredrevolution.com/bash-programming/find-the-parent-pid-of-a-bash-script' rel='bookmark' title='Permanent Link: Find the parent PID of a Bash Script'>Find the parent PID of a Bash Script</a></li>
<li><a href='http://www.wiredrevolution.com/bash-programming/find-the-exit-status-of-a-previous-command-in-bash' rel='bookmark' title='Permanent Link: Find the exit status of a previous command in Bash'>Find the exit status of a previous command in Bash</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.wiredrevolution.com/bash-programming/multiple-line-comments-in-bash/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Single versus double quotes in BASH</title>
		<link>http://www.wiredrevolution.com/bash-programming/single-versus-double-quotes-in-bash?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=single-versus-double-quotes-in-bash</link>
		<comments>http://www.wiredrevolution.com/bash-programming/single-versus-double-quotes-in-bash#comments</comments>
		<pubDate>Thu, 16 Oct 2008 03:50:30 +0000</pubDate>
		<dc:creator>Ryan</dc:creator>
				<category><![CDATA[bash]]></category>
		<category><![CDATA[BASH]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[quotes]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://www.wiredrevolution.com/?p=344</guid>
		<description><![CDATA[<img src="http://www.wiredrevolution.com/wp-content/uploads/bash_icon.png" width="80" height="34" alt="" title="bash" /><br/>Understanding the difference between double versus single quotes is important when using BASH. Many times you may have seen them being used interchangeably. The basic difference is that variable names will be expanded within double quotes but not within single ones. This example shows the normal output with no quotes. $ echo $USER ryan As [...]


Related posts<ol><li><a href='http://www.wiredrevolution.com/bash-programming/delete-a-specific-line-from-a-text-file-with-sed' rel='bookmark' title='Permanent Link: Delete a specific line from a text file with sed'>Delete a specific line from a text file with sed</a></li>
<li><a href='http://www.wiredrevolution.com/bash-programming/find-the-pid-of-a-background-child-process-in-bash' rel='bookmark' title='Permanent Link: Find the PID of a background child process in Bash'>Find the PID of a background child process in Bash</a></li>
<li><a href='http://www.wiredrevolution.com/bash-programming/customize-the-bash-ps1-command-prompt' rel='bookmark' title='Permanent Link: Customize the BASH PS1 command prompt'>Customize the BASH PS1 command prompt</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<img src="http://www.wiredrevolution.com/wp-content/uploads/bash_icon.png" width="80" height="34" alt="" title="bash" /><br/><p>Understanding the difference between double versus single quotes is important when using BASH.  Many times you may have seen them being used interchangeably. The basic difference is that variable names will be expanded within double quotes but not within single ones.</p>
<p>This example shows the normal output with no quotes.</p>
<pre>
$ echo $USER
</pre>
<pre>
ryan
</pre>
<p>As you can see the shell will expand the variable.</p>
<p>In this example we will surround the variable with double quotes.</p>
<pre>
$ echo "$USER"
</pre>
<pre>
ryan
</pre>
<p>We see the same result as before.</p>
<p>This time with single quotes.</p>
<pre>
$ echo '$USER'
</pre>
<pre>
$USER
</pre>
<p>The variable name is not expanded.</p>
<p>Here is another interesting case. The single quotes are inside the double quotes.</p>
<pre>
$ echo "'$USER'"
</pre>
<pre>
'ryan'
</pre>
<p>The variable is expanded and the single quotes are retained.</p>
<p>Here I flip the order with the single quotes on the outside.</p>
<pre>
$ echo '"$USER"'
</pre>
<pre>
"$USER"
</pre>
<p>The variable is not expanded but the double quotes are retained.</p>


<p>Related posts<ol><li><a href='http://www.wiredrevolution.com/bash-programming/delete-a-specific-line-from-a-text-file-with-sed' rel='bookmark' title='Permanent Link: Delete a specific line from a text file with sed'>Delete a specific line from a text file with sed</a></li>
<li><a href='http://www.wiredrevolution.com/bash-programming/find-the-pid-of-a-background-child-process-in-bash' rel='bookmark' title='Permanent Link: Find the PID of a background child process in Bash'>Find the PID of a background child process in Bash</a></li>
<li><a href='http://www.wiredrevolution.com/bash-programming/customize-the-bash-ps1-command-prompt' rel='bookmark' title='Permanent Link: Customize the BASH PS1 command prompt'>Customize the BASH PS1 command prompt</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.wiredrevolution.com/bash-programming/single-versus-double-quotes-in-bash/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

