In the following script (saved as script.sh
):
#!/bin/sh
cd $MY_PYTHON_WORKING_DIRECTORY
python script1.py
python script2.py
Then, when I try to run the command script.sh
in my bash shell, I got the error bash: script.sh: command not found
. Why does this not work as expected? If the first line of any scripts start by #!
prefix, then the following path on the line is interpreted as a command, right? For your information, even if I changed my first line to #!/bin/bash
, the same error still occurred. If I run the script as either sh script.sh
or bash script.sh
, then the script ran as expected.
Is there any way to run the script by just hitting script.sh
?
One more question, between sh
and bash
, which should I use? I'm on OS X 10.8 and my default shell is currently set bash
, but I wonder which one to use going forward.
Thanks.