<?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>Dammit Jim! &#187; quotation marks</title>
	<atom:link href="http://scott.sherrillmix.com/blog/tag/quotation-marks/feed/" rel="self" type="application/rss+xml" />
	<link>http://scott.sherrillmix.com/blog</link>
	<description>I'm a biologist not a...</description>
	<lastBuildDate>Tue, 12 Jan 2010 05:09:51 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Using quotation marks effectively in Unix</title>
		<link>http://scott.sherrillmix.com/blog/programmer/using-quotation-marks-effectively-in-unix/</link>
		<comments>http://scott.sherrillmix.com/blog/programmer/using-quotation-marks-effectively-in-unix/#comments</comments>
		<pubDate>Sun, 26 Nov 2006 19:00:39 +0000</pubDate>
		<dc:creator>ScottS-M</dc:creator>
				<category><![CDATA[Bash/UNIX]]></category>
		<category><![CDATA[Programmer]]></category>
		<category><![CDATA[back]]></category>
		<category><![CDATA[backtick]]></category>
		<category><![CDATA[double]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[quotation marks]]></category>
		<category><![CDATA[quote]]></category>
		<category><![CDATA[single]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://scott.sherrillmix.com/blog/programmer/using-quotation-marks-effectively-in-unix/</guid>
		<description><![CDATA[This is pretty basic knowledge but I&#8217;ve helped a few people out recently that had been using Unix/Linux for a while and didn&#8217;t know and it sure helped me out when I figured it out. If you had asked me how many quotation marks were on a keyboard before I started doing Bash stuff I [...]]]></description>
			<content:encoded><![CDATA[<p>This is pretty basic knowledge but I&#8217;ve helped a few people out recently that had been using Unix/Linux for a while and didn&#8217;t know and it sure helped me out when I figured it out. If you had asked me how many quotation marks were on a keyboard before I started doing Bash stuff I would have said two. But I, and it seems most non-programmers, often forget the little <code>`</code> on the same key as the tilde ~ (to the left of the numbers on standard keyboards). So there are actually three types of quotation marks and each one means something different to Unix:</p>

<dl>
<dt>Single quote/forward quote <code style="font-size:150%;font-weight: bold;">'</code></dt><dd>Just for clarity this is the key next to the Enter key on most keyboards. A pair of single quotes tells Unix that the contents are a string and that it should not mess around inside. For example: <code>x=17;echo 'This is $x';</code> will return <code>This is $x</code>. Unix did not replace the variable <code>$x</code> with 17.
</dd>
<dt>Double quote <code style="font-size:150%;font-weight: bold;">"</code></dt><dd>Double quotes again tell Unix that the contents are a string. Double quotes and the above single quotes useful for keeping Unix from messing up spaces. For example: <code>grep "To be or not to be" hamlet.txt</code> will search hamlet.txt for the famous line. In contrast, <code>grep To be or not to be hamlet.txt</code> searches for <code>To</code> in the files <code>be, or, not, to, be, hamlet.txt</code> (not what was intended). Double quotes are different from single quotes in that they allow Unix to replace variables inside them. For example: <code>x=17;echo "This is $x";</code> will return <code>This is 17</code>.</dd>
<dt>Backtick/back quote <code style="font-size:150%;font-weight: bold;">`</code></dt><dd>Just for clarity this is the key shared with ~ on most keyboards. These are really different than the other two. They tell Unix to run whatever command is inside and paste in the output. These are equivalent to using <code>$()</code>. For example: <code>echo "You are in `pwd`"</code> will return <code>You are in /usr/bin/</code> or whatever directory you are in. These can come in really handy. One common use is looping through files. Here&#8217;s a slightly more complex example that uses both double and back quotes to add the filename to every row in all text files in a directory: <code>for i in `ls *.txt`;do sed "s/^/$i /" $i >$i.new;done</code></dd>
</dl> 
<p>Knowing how these are used can really help with using Unix. The difference between <code>'commands'</code> and <code>"commands"</code> is pretty subtle but can make a big difference in the results. I learned this the hard way but hopefully now you won&#8217;t have to.</p>.]]></content:encoded>
			<wfw:commentRss>http://scott.sherrillmix.com/blog/programmer/using-quotation-marks-effectively-in-unix/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
