Previous Table of Contents Next


Module 107
printenv (BSD)

DESCRIPTION

The external printenv command displays your current environment. Your environment consists of variables set to certain values. If you specify an argument, the value of that variable is displayed. If the variable does not exist, printenv does not display anything and returns an exit status of 1. If the variable exists, the exit status is 0.

COMMAND FORMAT

The format of the printenv command follows.

     printenv [ variable ]

Arguments

Only one argument may be passed to the printenv command.

variable The name of a variable which exists in the environment. If no variable name is provided, then all variables defined are displayed.

RELATED COMMANDS

Refer to the ksh command described in Module 71.

APPLICATIONS

The printenv command is useful for displaying your current environment. You can display all variables in your current shell environment or display a specific variable. You will need to verify what a certain variable is set to while working on UNIX. One common variable you need to verify if vi fails to work properly is the TERM variable.

TYPICAL OPERATION

In this activity use the printenv command to display your environment. Begin at the shell prompt.

1.  Type printenv and press Return to list out your current environment.
     cj> printenv
     ENV=/u1/ts/mylogin/.kshrc
     FCEDIT=vi
     HOME=/u1/ts/mylogin
     LOGNAME=mylogin
     MAIL=/usr/mail/mylogin
     PATH=:/u1/ts/mylogin/bin:/bin:/usr/bin:/usr/lbin:/usr/local/bin
     SHELL=/bin/ksh
     TERM=vt100
     TMPDIR=/tmp
     TZ=CST6CDT
     VISUAL=vi
2.  Turn to Module 145 to continue the learning sequence.


Previous Table of Contents Next