I don't understand why I've got this error:
line 1: #!/bin/bash: No such file or directory
while running any piece of bash script like this:
#!/bin/bash
echo "pouet"
I've tried running it on a Fedora 19 and everything went well.
I'm on Debian 7, I've tried parsing the first line to search for \n\r
but everything was clean (every script I've made so far seems to behave the same way).
My $PATH
looks like this: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
.
I've tried it with a normal user or root, same result.
But the rest of the script seems to behave normally (echo is interpreted).
And yes, /bin/bash
exists and is executable.
Edit:
$ LC_ALL=C sed -n l < tesT.sh
\357\273\277#!/bin/bash$
echo "pouet"$
LC_ALL=C sed -n l < your-script
give? – Stéphane Chazelas Jan 18 '14 at 08:11LC_ALL=C sed -n l < tesT.sh \357\273\277#!/bin/bash$ echo "pouet"$
– doctori Jan 18 '14 at 08:15head -1 yourscript | od -c
– michas Jan 18 '14 at 08:18head -1 tesT.sh | od -c{ gives me this : 0000000 357 273 277 # ! / b i n / b a s h \n
I've removed the BOM with this :awk '{if(NR==1)sub(/^\xef\xbb\xbf/,"");print}' tesT.sh > test.sh.nobom
– doctori Jan 18 '14 at 08:20set nobomb
invim
to remove thatBOM
. Something in your~/.vimrc
must setbomb
, you should remove it as it's almost always recommended not to use a BOM for UTF8. – Stéphane Chazelas Jan 18 '14 at 08:40