Set an environment variable in Korn shell (ksh)

Home -> UNIX -> Shells -> ksh

26078 views

From the computer of: qmchenry (339 recipes)
Created: Oct 11, 2003     Updated: Nov 14, 2003


Add a comment

Add to:
Add to stumbleuponAdd to del.icio.usDigg itAdd to FURL

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

Subscribe to the Tech-Recipes Newsletter

You can get tips like this delivered in your email every week!

Enter your Email

We will never, ever sell your email address or spam you.





Related recipes:

  Checking if a variable is a number in ksh
  Enable vi ksh command line editing
  Reading a list of data into a function using a script.
  Some Common AIX/Unix Commands
  appending a list of files to one file using xargs command
  Creating a kornshell script with text-based menus in VI

 

Sponsored links

 

Login

Nickname

Password

Don't have an account yet? You can create one. As a registered user you have some advantages like theme manager, comments configuration and post comments with your name.