Previous Topic: The Directory the Job Runs UnderNext Topic: Shell Initialization Files


Determining Which Shell is Used

A shell is a program that provides an environment for users to interact with the system. Shell programs are files that contain a series of user commands that are grouped, using logic provided by the shell, to accomplish a task.

Shells can be defined by you, the script’s programmer, your agent administrator, and your UNIX administrator. When you define a job that runs on UNIX, you may want to know which shell is used to run the script because different shells have different facilities and characteristics. Some functions are specific to certain shells and may be incompatible with other shells.

The shell used is determined by the following settings in the following order:

  1. The SHELL statement (if specified in the job definition)
  2. The first line of the script (if the SHELL statement is not specified)
  3. The oscomponent.defaultshell parameter in the agent's agentparm.txt file (if not specified in the SHELL statement or in the script)
  4. The user default shell defined in the user profile (if not specified in one of the previous three locations)

Notes:

Example: Specify the Shell in the SHELL Statement

In this example, the C shell is specified in the SHELL statement.

AGENT UNIX_LA
SCRIPTNAME /mfg/test1.csh
SHELL /bin/csh

Example: Specify the Shell in the First Line of the Script

The first line of the following test1.csh script identifies the C shell:

#!/bin/csh -f
if ( $LOGNAME != guest) then
echo "User is not guest"
endif
echo $LOGNAME logon
exit 0

The following job definition does not contain the SHELL statement:

AGENT UNIX_LA
SCRIPTNAME /mfg/test1.csh
USER guest

In this example, agent UNIX_LA runs the test1.csh script using the C shell.