{"id":1073,"date":"2015-07-12T09:51:05","date_gmt":"2015-07-12T07:51:05","guid":{"rendered":"https:\/\/www.nullalo.com\/?p=1073"},"modified":"2025-10-22T10:16:32","modified_gmt":"2025-10-22T08:16:32","slug":"linux-scripting-come-correggere-lerrore-bad-interpreter","status":"publish","type":"post","link":"https:\/\/www.nullalo.com\/en\/linux-scripting-how-to-fix-bad-interpreter-error\/","title":{"rendered":"Linux scripting: how to fix &#8220;bad interpreter&#8221; error"},"content":{"rendered":"<p><\/p>\n<p style=\"text-align: justify;\">During bash script execution on\u00a0Linux,\u00a0it might happen to face\u00a0the following error:<\/p>\n<pre class=\"brush: bash; title: ; toolbar: false; notranslate\" title=\"\">&#x5B;root@localhost nullalo]# .\/configure\r\nbash: .\/configure: \/bin\/sh^M: bad interpreter: No such file or directory<\/pre>\n<p style=\"text-align: justify;\">This often happens when the executed script (in the above\u00a0example, the\u00a0&#8220;configure&#8221; file) has been edited\u00a0on a Windows OS\u00a0with an editor who saved it with <strong>DOS<\/strong> (CR + LF) line endings instead of <strong>Unix<\/strong> (LF) ones.<br \/>\nThe quickest way to solve the problem is to run one of these commands directly from Linux (obviously &#8220;configure&#8221; should be replaced with the name of your file):<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">sed -i 's\/\\r\/\/' configure\r\nperl -i -pe's\/\\r$\/\/;' configure<\/pre>\n<p style=\"text-align: justify;\">Also, if you use vi or vim as editor or Linux, you can run the following commands (with the ESC key to enter editor\u00a0command mode):<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">:set fileformat=unix\r\n:x! (or :wq!)<\/pre>\n<p style=\"text-align: justify;\">which, respectively, set the file format and save it, quitting\u00a0the editor.<\/p>\n<p><\/p>","protected":false},"excerpt":{"rendered":"<p>During bash script execution on\u00a0Linux,\u00a0it might happen to face\u00a0the following error: &#x5B;root@localhost nullalo]# .\/configure bash: .\/configure: \/bin\/sh^M: bad interpreter: No such file or directory This often happens when the executed script (in the above\u00a0example, the\u00a0&#8220;configure&#8221; file) has been edited\u00a0on a Windows OS\u00a0with an editor who saved it with DOS (CR<\/p>\n","protected":false},"author":2,"featured_media":1074,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[4],"tags":[90,89],"class_list":["post-1073","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-reviews","tag-errore","tag-linux"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Linux scripting: how to fix &quot;bad interpreter&quot; error - Nullalo!<\/title>\n<meta name=\"description\" content=\"How to fix &quot;bad interpreter&quot; error when executing Linux bash scripts.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.nullalo.com\/?p=1073\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Linux scripting: how to fix &quot;bad interpreter&quot; error - Nullalo!\" \/>\n<meta property=\"og:description\" content=\"[:it]Come correggere l&#039;errore &quot;bad interpreter&quot; relativo all&#039;esecuzione di bash script Linux.[:en]How to fix &quot;bad interpreter&quot; error when executing Linux bash scripts.[:]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.nullalo.com\/?p=1073\" \/>\n<meta property=\"og:site_name\" content=\"Nullalo!\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/nullalo\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/fulvio.sicurezza\" \/>\n<meta property=\"article:published_time\" content=\"2015-07-12T07:51:05+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-10-22T08:16:32+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.nullalo.com\/wp-content\/uploads\/2015\/07\/linux_script.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1140\" \/>\n\t<meta property=\"og:image:height\" content=\"600\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Fulvio Sicurezza\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/FulvioSicurezza\" \/>\n<meta name=\"twitter:site\" content=\"@Nullalo\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Fulvio Sicurezza\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.nullalo.com\/?p=1073\",\"url\":\"https:\/\/www.nullalo.com\/?p=1073\",\"name\":\"[:it]Linux scripting: come correggere l'errore \\\"bad interpreter\\\"[:en]Linux scripting: how to fix \\\"bad interpreter\\\" error[:] - Nullalo!\",\"isPartOf\":{\"@id\":\"https:\/\/www.nullalo.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.nullalo.com\/?p=1073#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.nullalo.com\/?p=1073#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.nullalo.com\/wp-content\/uploads\/2015\/07\/linux_script.jpg\",\"datePublished\":\"2015-07-12T07:51:05+00:00\",\"dateModified\":\"2025-10-22T08:16:32+00:00\",\"author\":{\"@id\":\"https:\/\/www.nullalo.com\/#\/schema\/person\/fe9c2885376a6ab076e06461ae1b546c\"},\"description\":\"[:it]Come correggere l'errore \\\"bad interpreter\\\" relativo all'esecuzione di bash script Linux.[:en]How to fix \\\"bad interpreter\\\" error when executing Linux bash scripts.[:]\",\"breadcrumb\":{\"@id\":\"https:\/\/www.nullalo.com\/?p=1073#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.nullalo.com\/?p=1073\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.nullalo.com\/?p=1073#primaryimage\",\"url\":\"https:\/\/www.nullalo.com\/wp-content\/uploads\/2015\/07\/linux_script.jpg\",\"contentUrl\":\"https:\/\/www.nullalo.com\/wp-content\/uploads\/2015\/07\/linux_script.jpg\",\"width\":1140,\"height\":600},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.nullalo.com\/?p=1073#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.nullalo.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Linux scripting: come correggere l&#8217;errore &#8220;bad interpreter&#8221;\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.nullalo.com\/#website\",\"url\":\"https:\/\/www.nullalo.com\/\",\"name\":\"Nullalo!\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.nullalo.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.nullalo.com\/#\/schema\/person\/fe9c2885376a6ab076e06461ae1b546c\",\"name\":\"Fulvio Sicurezza\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.nullalo.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.nullalo.com\/wp-content\/uploads\/2015\/02\/Fulvio-Sicurezza_avatar_1424711147-96x96.jpg\",\"contentUrl\":\"https:\/\/www.nullalo.com\/wp-content\/uploads\/2015\/02\/Fulvio-Sicurezza_avatar_1424711147-96x96.jpg\",\"caption\":\"Fulvio Sicurezza\"},\"sameAs\":[\"http:\/\/www.generalservice.na.it\",\"https:\/\/www.facebook.com\/fulvio.sicurezza\",\"http:\/\/it.linkedin.com\/in\/fulviosicurezza\",\"https:\/\/x.com\/https:\/\/twitter.com\/FulvioSicurezza\",\"https:\/\/www.youtube.com\/c\/FulvioSicurezzaIT\"],\"url\":\"https:\/\/www.nullalo.com\/en\/author\/f-sicurezza\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Linux scripting: how to fix \"bad interpreter\" error - Nullalo!","description":"How to fix \"bad interpreter\" error when executing Linux bash scripts.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.nullalo.com\/?p=1073","og_locale":"en_US","og_type":"article","og_title":"Linux scripting: how to fix \"bad interpreter\" error - Nullalo!","og_description":"[:it]Come correggere l'errore \"bad interpreter\" relativo all'esecuzione di bash script Linux.[:en]How to fix \"bad interpreter\" error when executing Linux bash scripts.[:]","og_url":"https:\/\/www.nullalo.com\/?p=1073","og_site_name":"Nullalo!","article_publisher":"https:\/\/www.facebook.com\/nullalo","article_author":"https:\/\/www.facebook.com\/fulvio.sicurezza","article_published_time":"2015-07-12T07:51:05+00:00","article_modified_time":"2025-10-22T08:16:32+00:00","og_image":[{"width":1140,"height":600,"url":"https:\/\/www.nullalo.com\/wp-content\/uploads\/2015\/07\/linux_script.jpg","type":"image\/jpeg"}],"author":"Fulvio Sicurezza","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/FulvioSicurezza","twitter_site":"@Nullalo","twitter_misc":{"Written by":"Fulvio Sicurezza","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.nullalo.com\/?p=1073","url":"https:\/\/www.nullalo.com\/?p=1073","name":"[:it]Linux scripting: come correggere l'errore \"bad interpreter\"[:en]Linux scripting: how to fix \"bad interpreter\" error[:] - Nullalo!","isPartOf":{"@id":"https:\/\/www.nullalo.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.nullalo.com\/?p=1073#primaryimage"},"image":{"@id":"https:\/\/www.nullalo.com\/?p=1073#primaryimage"},"thumbnailUrl":"https:\/\/www.nullalo.com\/wp-content\/uploads\/2015\/07\/linux_script.jpg","datePublished":"2015-07-12T07:51:05+00:00","dateModified":"2025-10-22T08:16:32+00:00","author":{"@id":"https:\/\/www.nullalo.com\/#\/schema\/person\/fe9c2885376a6ab076e06461ae1b546c"},"description":"[:it]Come correggere l'errore \"bad interpreter\" relativo all'esecuzione di bash script Linux.[:en]How to fix \"bad interpreter\" error when executing Linux bash scripts.[:]","breadcrumb":{"@id":"https:\/\/www.nullalo.com\/?p=1073#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.nullalo.com\/?p=1073"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.nullalo.com\/?p=1073#primaryimage","url":"https:\/\/www.nullalo.com\/wp-content\/uploads\/2015\/07\/linux_script.jpg","contentUrl":"https:\/\/www.nullalo.com\/wp-content\/uploads\/2015\/07\/linux_script.jpg","width":1140,"height":600},{"@type":"BreadcrumbList","@id":"https:\/\/www.nullalo.com\/?p=1073#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.nullalo.com\/"},{"@type":"ListItem","position":2,"name":"Linux scripting: come correggere l&#8217;errore &#8220;bad interpreter&#8221;"}]},{"@type":"WebSite","@id":"https:\/\/www.nullalo.com\/#website","url":"https:\/\/www.nullalo.com\/","name":"Nullalo!","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.nullalo.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.nullalo.com\/#\/schema\/person\/fe9c2885376a6ab076e06461ae1b546c","name":"Fulvio Sicurezza","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.nullalo.com\/#\/schema\/person\/image\/","url":"https:\/\/www.nullalo.com\/wp-content\/uploads\/2015\/02\/Fulvio-Sicurezza_avatar_1424711147-96x96.jpg","contentUrl":"https:\/\/www.nullalo.com\/wp-content\/uploads\/2015\/02\/Fulvio-Sicurezza_avatar_1424711147-96x96.jpg","caption":"Fulvio Sicurezza"},"sameAs":["http:\/\/www.generalservice.na.it","https:\/\/www.facebook.com\/fulvio.sicurezza","http:\/\/it.linkedin.com\/in\/fulviosicurezza","https:\/\/x.com\/https:\/\/twitter.com\/FulvioSicurezza","https:\/\/www.youtube.com\/c\/FulvioSicurezzaIT"],"url":"https:\/\/www.nullalo.com\/en\/author\/f-sicurezza\/"}]}},"_links":{"self":[{"href":"https:\/\/www.nullalo.com\/en\/wp-json\/wp\/v2\/posts\/1073","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.nullalo.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nullalo.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nullalo.com\/en\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nullalo.com\/en\/wp-json\/wp\/v2\/comments?post=1073"}],"version-history":[{"count":1,"href":"https:\/\/www.nullalo.com\/en\/wp-json\/wp\/v2\/posts\/1073\/revisions"}],"predecessor-version":[{"id":1950,"href":"https:\/\/www.nullalo.com\/en\/wp-json\/wp\/v2\/posts\/1073\/revisions\/1950"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.nullalo.com\/en\/wp-json\/wp\/v2\/media\/1074"}],"wp:attachment":[{"href":"https:\/\/www.nullalo.com\/en\/wp-json\/wp\/v2\/media?parent=1073"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nullalo.com\/en\/wp-json\/wp\/v2\/categories?post=1073"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nullalo.com\/en\/wp-json\/wp\/v2\/tags?post=1073"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}