Set an environment variable in Korn shell (ksh)

Contributor Icon Contributed by qmchenry  
Tag Icon Tagged: Korn shell  


An environment variable can be set and exported in the Korn shell with a single command. To set the EDITOR variable to vi, use:

export EDITOR=vi

This command can be placed in ~/.profile to be executed automatically at login, placed in a shell script, or executed manually. Exporting a variable makes it available to other shells spawned from the current shell as when running another command or shell script.

To add to an existing variable, such as path, use this format:

export PATH=$PATH:/usr/local/bin

 

3 Comments -


  1. mikolaj said on February 11, 2009

    20% text and 80% adds. The level of “tech recipe” is far too basic.

  2. pratap said on March 2, 2009

    how to remove the a perticular path from PATH env variable?

  3. eva said on September 17, 2010

    Fantastic! Your info is so good! now i’l never have to RTFM anymore. I have you, you are my friend for life!

 

RSS feed for comments on this post. TrackBack URL

Leave a comment -