{"id":1000360,"date":"2007-01-11T10:48:15","date_gmt":"2007-01-11T15:48:15","guid":{"rendered":"http:\/\/www.elharo.com\/blog\/mac\/2007\/01\/11\/bad-interpreter-no-such-file-or-directory\/"},"modified":"2007-01-11T13:59:52","modified_gmt":"2007-01-11T18:59:52","slug":"bad-interpreter-no-such-file-or-directory","status":"publish","type":"post","link":"https:\/\/www.elharo.com\/blog\/software-development\/perl\/2007\/01\/11\/bad-interpreter-no-such-file-or-directory\/","title":{"rendered":"bad interpreter: No such file or directory"},"content":{"rendered":"<p>You sometimes see this error message when attempting to run a Perl, Python, or shell script that uses a shebang line to find the interpreter. For example,<\/p>\n<pre>$ hello.pl\r\n-bash: hello.pl: command not found<\/pre>\n<p><!--more--><\/p>\n<p>This error message usually indicates a problem in the shebang line at the start of the script:<\/p>\n<pre><code>#!\/usr\/bin\/perl\r\nprint \"Hello Perl\\n\";<\/code><\/pre>\n<p>The most common cause of the problem is that the interpreter is not installed where you expect. For example, it&#8217;s in \/usr\/local\/bin instead of \/usr\/bin. However, there&#8217;s a second problem that can cause this symptom, especially if you&#8217;re working on a Mac; and it&#8217;s not nearly so obvious. If the first line ends in just a carriage return rather than a linefeed or a carriage return linefeed pair, then bash gets very confused.<\/p>\n<p>The fix is to modify the file so that it uses Unix linefeeds rather than Mac carriage returns to end each line. Some text editors like BBEdit allow you to configure this. You can also use the mac2unix utility bundled on most Unixes to accomplish this. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>You sometimes see this error message when attempting to run a Perl, Python, or shell script that uses a shebang line to find the interpreter. For example, $ hello.pl -bash: hello.pl: command not found<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[33],"tags":[410],"class_list":["post-1000360","post","type-post","status-publish","format-standard","hentry","category-perl","tag-flash"],"_links":{"self":[{"href":"https:\/\/www.elharo.com\/blog\/wp-json\/wp\/v2\/posts\/1000360","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.elharo.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.elharo.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.elharo.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.elharo.com\/blog\/wp-json\/wp\/v2\/comments?post=1000360"}],"version-history":[{"count":0,"href":"https:\/\/www.elharo.com\/blog\/wp-json\/wp\/v2\/posts\/1000360\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.elharo.com\/blog\/wp-json\/wp\/v2\/media?parent=1000360"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.elharo.com\/blog\/wp-json\/wp\/v2\/categories?post=1000360"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.elharo.com\/blog\/wp-json\/wp\/v2\/tags?post=1000360"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}