ARCHIVED: In Unix, how do I set an environment variable?

This content has been archived, and is no longer maintained by Indiana University. Information here may no longer be accurate, and links may no longer be available or reliable.

The command you use to set environment variables depends on which shell you are using. To determine your shell, at the Unix prompt, enter:

  echo $SHELL

To set environment variables, use the appropriate command below:

Bourne shells

  • For sh, enter:
      VARNAME="value"; export VARNAME
  • For ksh/bash, enter:
      export VARNAME="value"

C shells

  • For csh/tcsh, enter:
      setenv VARNAME "value"

This is document abcl in the Knowledge Base.
Last modified on 2018-01-18 08:52:46.