Operating Systems

Sooner or later, every systems programmer wants or needs to write a script for the systems they support. In the Linux world, the choices available are much broader than on z/OS or z/VM. Every “shell” that can be installed provides its own scripting language. These differ from each other in the same way the shells themselves do. The one shell scripting language you can count on being installed on any given system is the one that comes with the default shell the root user has specified. On most Linux systems, this is usually Bash (Bourne Again SHell). According to the man page for Bash:

“Bash is an sh-compatible command language interpreter that executes commands read from the standard input or from a file. Bash also incorporates useful features from the Korn and C shells (ksh and csh).

“Bash is intended to support the IEEE POSIX Shell and Tools specification (IEEE Working Group 1003.2).”

The man page for Bash, intended as a reference, not a tutorial, is almost 4,000 lines long on a 100-column terminal. Some people prefer to print it and keep it handy; others just view it on their terminal.

Unlike CLISTs or Rexx EXECs, shell scripts can be developed interactively by typing in commands, and seeing the results. This includes loops, if-then-else logic, etc. Elaborate, expand, debug, then stuff it into a file, and you have a script! Bash provides facilities that are available in most procedural programming languages:

• Assignment

• If-then-else

• Looping

• Simple arithmetic

• Terminal/keyboard I/O

6 Pages