{"id":1443,"date":"2013-10-17T11:14:01","date_gmt":"2013-10-17T11:14:01","guid":{"rendered":"https:\/\/raspberry-projects.com\/pi\/?p=1443"},"modified":"2026-06-17T09:15:40","modified_gmt":"2026-06-17T08:15:40","slug":"bash-files","status":"publish","type":"post","link":"https:\/\/raspberry-projects.com\/pi\/bash\/bash-files","title":{"rendered":"Bash Files"},"content":{"rendered":"<h4>\nFile Extension<br \/>\n<\/h4>\n<p>\n.sh is typical (but not mandatory)\n<\/p>\n<h4>\nFile Contents<br \/>\n<\/h4>\n<p>\nThe file should start with:\n<\/p>\n<pre>\r\n<code>\r\n#!\/bin\/bash\r\n<\/code><\/pre>\n<p>\nIf there is a problem with the interpreter being found type error message you can see where your systems bash interpreter is by typing &quot;which bash&quot; on the command line.\n<\/p>\n<p>\nBlank lines are fine.\n<\/p>\n<p>\nUse the # character for comments\n<\/p>\n<h4>\n<strong>Rules For Bash Files<\/strong><br \/>\n<\/h4>\n<p>\nDon&#39;t create the file in Widows notepad as you&#39;ll have incorrect line endings (carriage return, linefeed instead of the Unix linefeed only). &nbsp;This will cause the line &quot;#!\/bin\/bash&quot; to give this error:\n<\/p>\n<pre>\r\n<code>\r\n\/bin\/bash^M: bad interpreter: No such file or directory\r\n<\/code><\/pre>\n<p>\n^M is the carriage return character. &nbsp; You can correct this by opening the file in Leafpad, selecting Save As and changing the Character Coding from CR+LF to LF\n<\/p>\n<h4>\nThings you can do<br \/>\n<\/h4>\n<h5>\nPress return to move on<br \/>\n<\/h5>\n<pre>\r\n<code>\r\n#!\/bin\/bash\r\n\r\necho &quot;Press return to start&quot;\r\nread dummy\r\necho &quot;Ok here we go&quot;\r\n<\/code><\/pre>\n<h5>\nPause<br \/>\n<\/h5>\n<pre>\r\n<code>\r\n#!\/bin\/bash\r\n\r\necho &quot;Starting&quot;\r\nsleep 1\r\necho &quot;Ok here we go&quot;\r\n<\/code><\/pre>\n<p>\n&nbsp;\n<\/p>\n<h4>\nProblems<br \/>\n<\/h4>\n<p>\n^M: bad interpreter: No such file or directory\n<\/p>\n<p style=\"margin-left: 40px;\">\n<span style=\"font-size: 10px;\">See CR+LF problem in rules<\/span>\n<\/p>\n<p>\nNot found &quot;\/r&quot; errors or general errors with lines that should be fine\n<\/p>\n<p style=\"margin-left: 40px;\">\nSee CR+LF problem in rules\n<\/p>\n<p>\nScript won&#39;t run\n<\/p>\n<p style=\"margin-left: 40px;\">\nSet the file permissions so its executable<\/p>\n","protected":false},"excerpt":{"rendered":"<p>File Extension .sh is typical (but not mandatory) File Contents The file should start with: #!\/bin\/bash If there is a problem with the interpreter being found type error message you can see where your systems bash interpreter is by typing &quot;which bash&quot; on the command line. Blank lines are fine. Use the # character for [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"class_list":["post-1443","post","type-post","status-publish","format-standard","hentry","category-bash"],"_links":{"self":[{"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/posts\/1443","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/comments?post=1443"}],"version-history":[{"count":6,"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/posts\/1443\/revisions"}],"predecessor-version":[{"id":1705,"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/posts\/1443\/revisions\/1705"}],"wp:attachment":[{"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/media?parent=1443"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/categories?post=1443"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/tags?post=1443"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}