Contents
If you make the scrip executable with chmod 755
How do I run a shell script from another directory?
There are a couple of different ways you can do this:
- Make the other script executable, add the #!/bin/bash line at the top, and the path where the file is to the $PATH environment variable. …
- Or call it with the source command (alias is . ) …
- Or use the bash command to execute it: /bin/bash /path/to/script ;
How do I run a script manually in Linux?
Steps to write and execute a script
- Open the terminal. Go to the directory where you want to create your script.
- Create a file with . sh extension.
- Write the script in the file using an editor.
- Make the script executable with command chmod +x <fileName>.
- Run the script using ./<fileName>.