I have Apple macOS Unix laptop. I am learning shell script. How do I open file created bash script with a text editor? How do I run test.sh file?
The procedure to run .sh files in terminal is as follows:
- Open the terminal application
- Give executable permission to your bash shell script using chmod command:
chmod +x /path/to/script.sh
chmod +x test.sh
- Run your shell script:
/path/to/script.sh
## in the current directory
./test.sh
## or use bash/sh as follows
sh test.sh
bash /path/to/script.sh
I suggest you read:
2 Likes
Thank you
I tried to read it under the link you placed but I do not see where the problem is
GamesBX