Displaying the values of variables, Clearing the values of variables, Example .profile file – HP NonStop G-Series User Manual

Page 48

Advertising
background image

$ . ./.profile

Displaying the Values of Variables

You can display the value of any variable currently set in your shell. To display the value of a
single variable, use the echo command in the following general format:

echo $variable

The variable entry specifies the variable whose value you want displayed. For example, to
display the value of the SHELL environment variable, enter:

$ echo $SHELL

/bin/sh

To display the value of all currently set variables, use the set command without any options. The
following example lists the currently set values in the shell (your output may vary):

$ set

EDITOR=vi

HOME=/users/chang

LOGNAME=chang

PATH=:/bin:/bin/X11

PS1=$

SHELL=/bin/sh

TERM=xterm

Clearing the Values of Variables

You can remove the value of (clear) any current variable. The following variables, however, cannot
be cleared:

PATH

PS1

PS2

IFS

You clear currently set variables with the unset command. The general format for the unset
command is the following:

unset name

The name entry specifies the name of the variable to be cleared. For example, suppose you have
created a variable called place and have assigned it a value of U. S. A. To clear the variable,
enter the following:

$ unset $place

Example .profile File

The following features are commonly set in .profile:

Terminal characteristics

Search path and other environment variables

Shell variables

Maximum permissions for new files with umask

48

The OSS Shell

Advertising
This manual is related to the following products: