UNIX for OpenVMS Users, Second Edition

The OpenVMS user executes a DCL command procedure by placing @ before the name of the command file; consistent with other commands, the UNIX user executes a shell script using only the name of the script file. If no directory specification precedes the script file name, the shell will search the paths described by the shell variable path for the C shell, and PATH for the Korn shell, to resolve the reference to the script file. Entries within path and PATH, such as /usr/sbin and /usr/bin (see Section 2.3), contain many of the programs and scripts that make up the UNIX command set and usually precede an entry consisting solely of a period, signifying the current directory. UNIX users frequently add paths of the type ~user/bin and ~user/etc to the files .login, .cshrc, or .profile (see below) to indicate directories that the system should search to resolve references to their own shell scripts and other programs. To be interpreted by the shell, the shell script must have file permission ( "x" permission) that renders it executable by the user.

Like all UNIX commands that are not part of the shell, the script file normally executes in a child shell forked by the parent shell. (See Section 10.9.4 for an exception.) Normally this child shell takes on all the predefined variables assigned to the parent shell as well as...