<?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; standard input</title>
	<atom:link href="http://scott.sherrillmix.com/blog/tag/standard-input/feed/" rel="self" type="application/rss+xml" />
	<link>http://scott.sherrillmix.com/blog</link>
	<description>I'm a biologist not a...</description>
	<lastBuildDate>Mon, 06 Feb 2012 05:19:08 +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>Tab Indented Standard Input Redirect in Bash</title>
		<link>http://scott.sherrillmix.com/blog/programmer/tab-indented-standard-input-redirect-in-bash/</link>
		<comments>http://scott.sherrillmix.com/blog/programmer/tab-indented-standard-input-redirect-in-bash/#comments</comments>
		<pubDate>Mon, 13 Jul 2009 02:52:43 +0000</pubDate>
		<dc:creator>ScottS-M</dc:creator>
				<category><![CDATA[Bash/UNIX]]></category>
		<category><![CDATA[Programmer]]></category>
		<category><![CDATA[EOF]]></category>
		<category><![CDATA[indent]]></category>
		<category><![CDATA[redirect]]></category>
		<category><![CDATA[standard input]]></category>
		<category><![CDATA[tab]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://scott.sherrillmix.com/blog/?p=502</guid>
		<description><![CDATA[I managed to forget how to redirect standard input (when you want to feed a bunch of lines to a program) in a bash script while still indenting and had to go digging around for it. So I figured I'd make a note here so I don't forget again and for anyone else in the [...]]]></description>
			<content:encoded><![CDATA[<p>I managed to forget how to redirect standard input (when you want to feed a bunch of lines to a program) in a bash script while still indenting and had to go digging around for it. So I figured I'd make a note here so I don't forget again and for anyone else in the same boat. It's just <code>&lt;&lt;-</code> instead of <code>&lt;&lt;</code>. For example if you want to keep indentation within a loop:</p>
<div class="syntax_hilite"><span class="langName">BASH:</span><br /><div id="bash-2">
<div class="bash"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">for</span> i <span style="color: #b1b100;">in</span> <span style="color: #cc66cc;color:#800000;">1</span> <span style="color: #cc66cc;color:#800000;">2</span> <span style="color: #cc66cc;color:#800000;">3</span> <span style="color: #cc66cc;color:#800000;">4</span>;do</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; cat&lt;&lt;-EOF</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; This is loop <span style="color: #0000ff;">$i</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; More advanced stuff could go here</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; EOF</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">done</span> </div></li></ol></div>
</div></div><br />
<p>You can use whatever you want to indicate the end of the input instead of EOF if it floats your boat (as long as you use the same thing both times) but unfortunately <code>&lt;&lt;-</code> doesn't work with spaces for indentation (although I'm a tab man myself).</p>
]]></content:encoded>
			<wfw:commentRss>http://scott.sherrillmix.com/blog/programmer/tab-indented-standard-input-redirect-in-bash/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Reading Standard Input in a Bash Shell Script</title>
		<link>http://scott.sherrillmix.com/blog/programmer/reading-standard-input-in-a-bash-shell-script/</link>
		<comments>http://scott.sherrillmix.com/blog/programmer/reading-standard-input-in-a-bash-shell-script/#comments</comments>
		<pubDate>Sat, 08 Jul 2006 12:34:01 +0000</pubDate>
		<dc:creator>ScottS-M</dc:creator>
				<category><![CDATA[Bash/UNIX]]></category>
		<category><![CDATA[Programmer]]></category>
		<category><![CDATA[ENTER]]></category>
		<category><![CDATA[get]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[read]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[standard input]]></category>
		<category><![CDATA[stdin]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://scott.sherrillmix.com/blog/uncategorized/reading-standard-input-in-a-bash-shell-script/</guid>
		<description><![CDATA[I guess this is obvious to most people but it took me quite a while to dig it out on the internet. I wanted my bash script to be able to read from standard input like cat sourcefile.txt&#124;bash myscript.bash. It turns out the standard input can be read from /dev/stdin. So if I wanted to [...]]]></description>
			<content:encoded><![CDATA[<p>I guess this is obvious to most people but it took me quite a while to dig it out on the internet. I wanted  my bash script to be able to read from standard input like <code>cat sourcefile.txt|bash myscript.bash</code>.  It turns out the standard input can be read from <code>/dev/stdin</code>. So if I wanted to <code>sort</code> the standard input, myscript.bash would look like: <code>sort /dev/stdin</code></p>

<p>I think this is probably basic UNIX knowledge but I'm not a programmer.</p>]]></content:encoded>
			<wfw:commentRss>http://scott.sherrillmix.com/blog/programmer/reading-standard-input-in-a-bash-shell-script/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

