You need to use the chmod
tool to indicate to the operating system that the text file is executable (that is, its contents can be run as a shell script).
To make a file executable, enter the following command:
chmod 755 YourScriptName.sh
After making the shell script file executable, you can run it by entering its pathname. For example:
~/Documents/Dev/YourScriptName.sh
or
cd ~/Documents/Dev/ ./YourScriptName.sh
For more information about using chmod
, see its man page.