Wednesday, December 18, 2024
HomeUNIX shellKorn shellSet an environment variable in Korn shell (ksh)

Set an environment variable in Korn shell (ksh)


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

Quinn McHenry
Quinn McHenry
Quinn was one of the original co-founders of Tech-Recipes. He is currently crafting iOS applications as a senior developer at Small Planet Digital in Brooklyn, New York.
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

LATEST REVIEWS

Recent Comments

error: Content is protected !!