Customizing your .profile

When you start the z/OS shell, it uses information in three files to determine your particular needs or preferences as a user. The files are accessed in this order:

  1. /etc/profile
  2. $HOME/.profile
  3. The file that the ENV variable specifies.

Settings established in a file accessed earlier can be overwritten by the settings in a file accessed later.

The /etc/profile file provides a default system-wide user environment. The systems programmer can modify the variables in this file to reflect local needs (for example, the time zone or the language). If you do not have an individual user profile, the values in the /etc/profile are used during your shell session.

The $HOME/.profile file (where $HOME is a variable for the home directory for your individual user ID) is an individual user profile. Any values in the .profile file in your home directory that differ with those in the /etc/profile file override them during your shell session. z/OS provides a sample individual user profile. Your administrator may set up such a file for you, or you may create your own.

Typically, your .profile might contain the following lines:
      export ENV=$HOME/.setup  #set and export ENV variable
      export PATH=$PATH:$HOME:  #set and export PATH variable
      export EDITOR=ed          #set and export EDITOR variable
      export PS1='$LOGNAME':'$PWD':' >'

If the value on the right-hand side of the = sign does not contain spaces, tab characters, or other special characters, you can leave out the single quotation marks.

Each of the lines begins with an export command. For the z/OS shell, this sets the variable and also specifies that whenever a subshell is created, these variables should be exported to it. You can also set a variable on one line and export it on another, as shown here:
ENV=$HOME/.setup
export ENV 
If portability to a Bourne shell is a consideration, use the two-line syntax. See Exporting variables for more information about exporting variables.
export ENV=$HOME/.setup
Identifies the .setup file in your home directory as your login script (also known as a setup script or environment file) and specifies that whenever a shell is created, the ENV variable should be exported to it. See Customizing your shell environment: The ENV variable for more information about a login script.
export PATH=$PATH:$HOME:
Identifies the search path to be used when locating a file or directory, and specifies that whenever a subshell is created, the PATH variable should be exported to it. Here, the system first searches the path identified in the PATH variable in /etc/profile, the system profile; then the system searches your home directory; finally, the system searches your current working directory. A leading or trailing colon, or two colons in a row, represents the current working directory. To avoid confusion, this is often expressed as:
export PATH=$PATH:$HOME:.
This PATH setting and the one in the example are equivalent. See Customizing the search path for commands: The PATH variable for more information.
export PS1='$LOGNAME:$PWD: >'
Identifies the shell prompt that indicates when the shell is ready for input, and specifies that whenever a subshell is created, the PS1 variable should be exported to it. Here the prompt (default is $) has been customized to show your login name and working directory. For example, for user ID TURBO working in the home directory, the prompt would display as:
turbo:/u/turbo: >
When TURBO changes directories, the prompt changes to indicate the working directory.
export EDITOR=ed
Identifies ed as the default editor used by some of the utilities, such as mailx, and specifies that whenever a subshell is created, the EDITOR variable should be exported to it.

If you create a subshell with the command sh –L, the shell starts and reads and executes your profile file. Note that the letter L must be in uppercase. The shell looks for .profile in the $HOME directory. If it is not found, the shell looks in the working directory; therefore, make sure that you are working in the right directory when you enter this command.