Set an environment variable in Korn shell (ksh)

Contributor Icon Contributed by qmchenry Date Icon October 11, 2003  
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

Previous recipe | Next recipe |
 

 
close Reblog this comment
blog comments powered by Disqus