<?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>tech stuff &#187; bad interpreter</title>
	<atom:link href="http://codytaylor.org/tag/bad-interpreter/feed" rel="self" type="application/rss+xml" />
	<link>http://codytaylor.org</link>
	<description>From Cody Taylor.</description>
	<lastBuildDate>Sun, 30 Oct 2011 04:15:41 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Bash Shell Script Error. &#8220;bad interpreter: No such file or directory error&#8221;</title>
		<link>http://codytaylor.org/2009/09/bash-shell-script-error-bad-interpreter-no-such-file-or-directory-error.html</link>
		<comments>http://codytaylor.org/2009/09/bash-shell-script-error-bad-interpreter-no-such-file-or-directory-error.html#comments</comments>
		<pubDate>Sun, 20 Sep 2009 17:31:37 +0000</pubDate>
		<dc:creator>Cody Taylor</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[problems and solutions]]></category>
		<category><![CDATA[reference]]></category>
		<category><![CDATA[.ipa]]></category>
		<category><![CDATA[bad interpreter]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[problem]]></category>
		<category><![CDATA[shell script]]></category>
		<category><![CDATA[solution]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[wikipedia]]></category>

		<guid isPermaLink="false">http://codytaylor.org/?p=14250</guid>
		<description><![CDATA[bad interpreter: No such file or directory error  /bin/sh^M: bad interpreter: No such file or directory error bash problem]]></description>
			<content:encoded><![CDATA[<p>Today I created a simple shell script and I was getting a few odd errors:<pre><code>
cody@taylor:/var/some_folder/server$ ./process_xml.sh
-bash: ./process_xml.sh: /bin/sh^M: bad interpreter: No such file or directory
</code></pre></p>
<p>I figured it was probably a permissions error or an issue with the <a href='http://en.wikipedia.org/wiki/Shebang_(Unix)' title='shebang'>shebang</a> (#!/bin/sh) line. I tried removing the shebang line, changing it to use dash or bash explicitly, chmoding to 777 and still no luck and another odd error.<pre><code>
cody@taylor:/var/some_folder/server$ sh process_xml.sh
: not found.sh: 4:
</code></pre></p>
<p>I then checked the log file that the commands were supposed to be writing to and it was filled with &#8216;^M&#8217; on every line break and the log name itself was followed by a &#8216;?&#8217;. Took a minute or two but I finally clued in that I wrote that script on a windows machine and then exported it to an ubuntu linux server via subversion. It was just a basic text format issue.</p>
<p>Under DOS (Windows/PC) the end of a line of text is signalled using the ASCII code sequence CarriageReturn,LineFeed. Alternately written as CR,LF or the bytes 0&#215;0D,0&#215;0A. On the Macintosh platform, only the CR character is used. Under UNIX, the opposite is true and only the LF character is used. </p>
<p>After a quick :<br />
<pre><code>
cody@taylor:/var/some_folder/server$ apt-get install tofrodos
cody@taylor:/var/some_folder/server$ dos2unix process_xml.sh
</code></pre></p>
<p>Everything worked fine.</p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fcodytaylor.org%2F2009%2F09%2Fbash-shell-script-error-bad-interpreter-no-such-file-or-directory-error.html&amp;linkname=Bash%20Shell%20Script%20Error.%20%26%238220%3Bbad%20interpreter%3A%20No%20such%20file%20or%20directory%20error%26%238221%3B"><img src="http://codytaylor.org/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://codytaylor.org/2009/09/bash-shell-script-error-bad-interpreter-no-such-file-or-directory-error.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

