Any Bash script always gives Command not found Any Bash script always gives Command not found shell shell

Any Bash script always gives Command not found


I believe that the problem isn't with the permissions on your user account but with the file itself. I just did exactly what you said, and it didn't run, I realized, because the file permissions didn't allow you to run it. Either do

chmod +x hello.sh 

or do

sh hello.sh

Either of those should work.


Has the Execute bit

Ensure the file has the execute bit set

$ chmod +x hello.sh

On your system bash isn't in /bin

You can determine where bash is installed on your system with

$ type -path bash

Use env to search the path

And you can use env to search in your shell script declarations like

#!/usr/bin/env bash