Command Format: sh [-acefhiknrstuvx] [args]
(See Appendix A for a complete list of options etc)
A Shell script is an executable plain file that contains UNIX and
shell commands. To execute the shell script type the name of the
script at the prompt. A simple shell script called shell_ex is
shown in the following example. The output from the execution of
the shell is also shown.
Sample Session:
$cat shell_ex
echo "This is a very simple shell procedure "
echo "created with the basic echo command "
echo "and three other very basic commands "
echo
ps
echo
who
echo
ls
$sh shell_ex
This is a very simple shell procedure
created with the very basic echo command
and three other very basic commands
PID TTY TIME COMMAND
10443 rt02120 0:01 sh
10427 rt02120 0:04 ksh
sgavlick rt021e0 Sep 7 13:26
teacher rt021b0 Sep 7 14:39
memo
class_notes
$
Command Format: sh [-acefhiknrstuvx] [args]
See Appendix A for a complete list of options etc
The option to turn on tracing is -x. For an example, let's trace
the execution of the simple script shell_ex.
Sample session:
$cat shell_ex
echo "This is a very simple shell procedure "
echo "created with the basic echo command "
echo "and three other very basic commands "
echo
ps
echo
who
echo
ls
$
Execute the BourneShell script using the -x option on the call to
the shell. The following sample session shows how to do this and
it shows the results of the trace.
Sample session:
$sh -x shell_ex
+ echo This is a very simple shell procedure
This is a very simple shell procedure
+ echo created with the basic echo command
created with the basic echo command
+ echo and three other very basic commands
and three other very basic commands
+ echo
+ ps
PID TTY TIME COMMAND
10443 rt01120 0:01 sh
10427 rt02120 0:04 ksh
+ echo
+ who
sgavlick rt021e0 Sep 7 13:26
teacher rt02120 Sep 7 14:39
+ echo
+ ls
memo
class_notes
$
The commands as read from the BourneShell script are indicated by
the plus sign (+). The next line or lines are the results of the
execution of the command. Using this tracing option allows you to
se the execution of each command in the script and see the results
of that execution.