<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>experiences in software architecture &#187; Bash_Scripting</title>
	<atom:link href="http://runtimeexception.wordpress.com/category/bash_scripting/feed/" rel="self" type="application/rss+xml" />
	<link>http://runtimeexception.wordpress.com</link>
	<description>... and the world as it definitely should not be</description>
	<lastBuildDate>Tue, 21 Apr 2009 08:24:44 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='runtimeexception.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/d11f31baf577887c525bd32714d39331?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>experiences in software architecture &#187; Bash_Scripting</title>
		<link>http://runtimeexception.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://runtimeexception.wordpress.com/osd.xml" title="experiences in software architecture" />
		<item>
		<title>&#8220;Here Document&#8221; in Bash-Script made stupid problems</title>
		<link>http://runtimeexception.wordpress.com/2008/12/02/here-document-in-bash-script-made-stupid-problems/</link>
		<comments>http://runtimeexception.wordpress.com/2008/12/02/here-document-in-bash-script-made-stupid-problems/#comments</comments>
		<pubDate>Tue, 02 Dec 2008 16:27:41 +0000</pubDate>
		<dc:creator>runtimeexception</dc:creator>
				<category><![CDATA[Bash_Scripting]]></category>
		<category><![CDATA[bash script here_document]]></category>

		<guid isPermaLink="false">http://runtimeexception.wordpress.com/?p=14</guid>
		<description><![CDATA[In a bash-script I wrote I had a stupid problem with the &#8220;&#60;&#60;&#8221; (here document) operator. And this is only because I am too structured   I wanted to write an ftp-call inside a for-loop, something like that:

#!/bin/sh
for filename in `awk '{print $1}' /my/directory/myfilewithfilenames.dat`
do
    ftp -n &#60;&#60;EOFTP
     [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=runtimeexception.wordpress.com&blog=2285081&post=14&subd=runtimeexception&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>In a bash-script I wrote I had a stupid problem with the &#8220;&lt;&lt;&#8221; (here document) operator. And this is only because I am too structured <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  I wanted to write an ftp-call inside a for-loop, something like that:</p>
<pre>
#!/bin/sh
for filename in `awk '{print $1}' /my/directory/myfilewithfilenames.dat`
do
    ftp -n &lt;&lt;EOFTP
        open my.ftp.host
        user myusername mypwd
        put $filename
    EOFTP
done
</pre>
<p>Do you see the problem? Well, it is simply, that the end of &#8220;here document&#8221;, the &#8220;EOFTP&#8221; must not be indented. It must look like this instead.</p>
<pre>
#!/bin/sh
for filename in `awk '{print $1}' /my/directory/myfilewithfilenames.dat`
do
    ftp -n &lt;&lt;EOFTP
        open my.ftp.host
        user myusername mypwd
        put $filename
EOFTP
done
</pre>
<p>This cost me half a day. And it is so ugly, insn&#8217;t it? I think I don&#8217;t like shell-scripting at all. I will return to python, or maybe perl, whereever I can. Grmpf.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/runtimeexception.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/runtimeexception.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/runtimeexception.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/runtimeexception.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/runtimeexception.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/runtimeexception.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/runtimeexception.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/runtimeexception.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/runtimeexception.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/runtimeexception.wordpress.com/14/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=runtimeexception.wordpress.com&blog=2285081&post=14&subd=runtimeexception&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://runtimeexception.wordpress.com/2008/12/02/here-document-in-bash-script-made-stupid-problems/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8b1c8fbea58161038bea0f64f43868fb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">runtimeexception</media:title>
		</media:content>
	</item>
	</channel>
</rss>