#!/bin/bash - No Such File Or Directory
Answer : This kind of message is usually due to a bogus shebang line, either an extra carriage return at the end of the first line or a BOM at the beginning of it. Run: $ head -1 yourscript | od -c and see how it ends. This is wrong: 0000000 # ! / b i n / b a s h \r \n This is wrong too: 0000000 357 273 277 # ! / b i n / b a s h \n This is correct: 0000000 # ! / b i n / b a s h \n Use dos2unix (or sed , tr , awk , perl , python …) to fix your script if this is the issue. Here is one that will remove both of a BOM and tailing CRs: sed -i '1s/^.*#//;s/\r$//' brokenScript Note that the shell you are using to run the script will slightly affect the error messages that are displayed. Here are three scripts just showing their name ( echo $0 ) and having the following respective shebang lines: correctScript: 0000000 # ! / b i n / b a s h \n scriptWithBom...