0

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
5

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:

#!/bin/bash
  • @ali Would it be possible that you accept my answer? This would also show others that your question has an answer. – Ingo Sep 4 '18 at 12:04

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.