Solving problems with your script
Even if your environment is set up correctly, any long script that
you write will almost certainly fail to work correctly under some
circumstances. This may be due to a failure to consider all the
conditions under which the script may be run, or due to an oversight
or syntax error in the script. The best way to get used to creating
small to medium sized shell scripts is to do the following:
-
Work out what you want the script to do.
-
Decompose the successive stages in the process into separate
steps.
-
Test and debug each individual step interactively, at the shell
prompt.
This method, known as bottom-up programming, is especially suited to
small scripts (those which contain less than about fifty lines of
commands). For longer programs, you may need to learn more about
programming techniques. (See
``Learning the shells''
and
``Learning the C programming language''
for references to more advanced texts.)
Next topic:
What to do if your shell script fails
Previous topic:
Solving problems with the environment
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 03 June 2005