<?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>One Giant Robot After Another &#187; shell scripting</title>
	<atom:link href="http://kang-chen.com/wp/tag/shell-scripting/feed/" rel="self" type="application/rss+xml" />
	<link>http://kang-chen.com/wp</link>
	<description>Kang Chen&#039;s Online Portfolio and Blog</description>
	<lastBuildDate>Sun, 29 Nov 2009 05:33:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Inserting new line in echo command</title>
		<link>http://kang-chen.com/wp/2009/07/09/inserting-new-line-in-echo-command/</link>
		<comments>http://kang-chen.com/wp/2009/07/09/inserting-new-line-in-echo-command/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 23:38:41 +0000</pubDate>
		<dc:creator>Kang</dc:creator>
				<category><![CDATA[Mac OS]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[featured]]></category>
		<category><![CDATA[shell scripting]]></category>

		<guid isPermaLink="false">http://kang-chen.com/wp/?p=20</guid>
		<description><![CDATA[Out of curiosity and the perfectionist in me, I &#8220;had&#8221; to print a line of text in the output inside a BASH shell script. I didn&#8217;t really want to split them into multiple echo statements since it&#8217;s a waste of space and actually harder to read for me. The first thing I tried was: &#62; [...]]]></description>
			<content:encoded><![CDATA[<p>Out of curiosity and the perfectionist in me, I &#8220;had&#8221; to print a line of text in the output inside a BASH shell script. I didn&#8217;t really want to split them into multiple echo statements since it&#8217;s a waste of space and actually harder to read for me. The first thing I tried was:</p>
<p>&gt; echo &#8220;Line1\nLine2&#8243; # Line1\nLine2</p>
<p>That clearly didn&#8217;t work out so well&#8230; so I thought maybe my Mac (OS X 10.5.7) likes &#8216;\r\n&#8217; more:<span id="more-20"></span></p>
<p>&gt; echo &#8220;Line1\r\nLine2&#8243; # line1\r\nline2</p>
<p>Still nope! As I found out later on though, not all versions of echo supports backslash escape characters. A quick look up in the MAN page for echo revealed that I needed to pass in the -e option in order to enable this capability:</p>
<p>&gt; echo -e &#8220;Line1\nLine2&#8243;</p>
<p>Line1<br />
Line2</p>
<p>TADA! Third time is the charm!</p>
<!-- PHP 5.x -->]]></content:encoded>
			<wfw:commentRss>http://kang-chen.com/wp/2009/07/09/inserting-new-line-in-echo-command/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

