Chapter 14. Issuing System Commands

Overview

One important use of Rexx is to develop command procedures. These are scripts that issue operating system commands. The ability to create command procedures is one of Rexx's great advantages. You can automate repetitive tasks, create scripts for system administration, and customize or tailor the operating system to your preferences.

Command procedures must manage many aspects of interaction with the operating systems, such as building and issuing the proper OS commands and handling bad return codes and errors.

Many refer to command procedures as shell scripts, although technically this is not quite accurate because Rexx is not a shell. Rexx is a scripting language interpreter that runs outside of the shell or OS command interpreter. (There is one exception: a version of Regina runs within the zsh shell and provides true shell scripting capability. With it you can permanently change the current environment and perform tasks that can only be accomplished from within a shell, such as setting environmental variables and changing the working directory).

Command procedures are useful for a wide variety of reasons. Scripting operating system commands allows you to:

  • Automate repetitive tasks — Ever been faced with entering a lengthy list of commands to get something done? Scripting allows you to automate these tasks, whether they are for system administration or simply for individual users.

    An example is an "install script." For one site the author ...

Get Rexx Programmer's Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.