Product Site

1.17.2. Shebang support

Rexx supports shebangs, also called hashbangs, as the first line of a Rexx program on both Unix-like and Windows systems.

Typically, shebangs are found on Unix-like systems to identify the script language with which to run a script. On these systems, to run a script as a Rexx program, depending on where the interpreter is installed, the shebang would be something like #!/usr/bin/rexx.

With several Unix-like systems changing the standard installation location away from /usr/bin (including macOS), a new convention is used for the sample programs, which works if the Rexx interpreter is anywhere on the path. This convention uses the env command in the shebang, like this: #!/usr/bin/env rexx. This has the advantage that it is portable, and will use the first occurrence of rexx that is found on $PATH.

On a Windows system, Rexx will simply ignore the first line of a Rexx program, if it starts with the character sequence "#!".