I wrote a shell script for my Raspberry Pi and made it executable. When I run ./filename.sh, I see an error:

bash: ./filename.sh: bin/bash: bad interpreter: No such file or directory

I wrote this script in the default directory (/home/pi). After the error occurred, I put a copy of the script on my desktop but I see the same error.

What is the problem and solution?

  • Do you think it would be easier to help you if you actually included the script that you wrote? – RalfFriedl Sep 4 '18 at 6:30

A script is running without its interpreter when it is made executable and contains a shebang at the very first line. Because your script is running I assume that's the case with your script. But the error message shows that you miss the leading slash in the path to bash. Your shebang should look as follows:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.