Set Up Environment Variable on Bourne, Bash, Korn and C-Shells

There are many shells available for the UNIX operating system. Among them are sh (bourne), csh (C), tsch (korn) and bash (bourne again) Shells.

With all these shells, sometimes we can mix all the syntax when assigning values to a variables. Here’s is another review so you wont forget:

C Shell (csh) or Korn (tcsh):

hostname# setenv LD_LIBRARY_PATH /usr/local/lib
hostname#
setenv MYVAR /usr/mydir

$PATH before and after:

hostname# echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin
hostname#
setenv PATH ${PATH}:/usr/local/local/bin
hostname#
echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/local/bin

For Bash (bash), Bourne (sh) or Korn (tcsh):

EDITOR=vi
export EDITOR

Study the syntax and let’s discuss…

One thought on “Set Up Environment Variable on Bourne, Bash, Korn and C-Shells”

Leave a Reply

Your email address will not be published. Required fields are marked *