Setting Environment Variables
Problem
You
need to modify your operating environment, for example, to change
your shell’s PATH setting.
Solution
Edit the appropriate shell startup file. Under Windows NT-based systems, another alternative is to use the System control panel.
Discussion
The shell or command interpreter you use to run programs from the
command-line prompt includes an environment in which you can store
variable values. Some of these variables are used by the shell
itself. For example, it uses PATH to determine
which directories to look in for programs such as
mysql. Other variables are used by other programs
(such as PERL5LIB, which tells Perl where to look
for library files used by Perl scripts).
Your shell determines the syntax used to set environment variables, as well as the startup file in which to place the settings. Typical startup files for various shells are shown in the following table. If you’ve never looked through your shell’s startup files, it’s a good idea to do so to familiarize yourself with their contents.
|
Shell |
Possible startup files |
|---|---|
|
csh, tcsh |
|
|
sh, bash, ksh |
|
|
DOS prompt |
|
The following examples show how to set the PATH
variable so that it includes the directory where the
mysql program is installed. The examples assume
there is an existing PATH setting in one of your
startup files. If you have no PATH setting currently, simply add the appropriate line or lines to ...