Once you have a shell script file created with the correct file permissions set, you can execute that shell script from any command line.
Because the shell script file that you have been creating in this module automatically starts the Bourne shell (using the information on the first line of the script), you can start your shell script file from within any shell, including the C shell used by default in the DispersedNet UNIX Lab.
You execute a shell script in UNIX just as you would any other program, by entering the name of the file that you want to execute. When you enter a standard UNIX command, however, that command is located in a standard directory on the system, such as /usr/local/bin. Your script file is probably not located in one of the standard directories. Instead, it is probably located in your home directory. If you use the script name alone (
welcome
in this example), the script file cannot be located:
% welcome
welcome: not found
When you execute any program, UNIX searches all the standard directories included in your PATH environment variable.
To indicate that your shell script is not in one of those standard directories, you must indicate where the script is located. In most cases, the script is located in your current working directory, which can be indicated with a period (.).
To start a shell script called welcome that is located in your home directory, use this command:
% ./welcome
The script is executed.