An environment variable must be set and exported with separate commands in the Bourne shell. To set the EDITOR variable to vi, use:
These commands 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 EDITOR
Multiple variables can be exported with one export command.