Why set an environment variable
Environment variables are used under Linux (as well as under other systems), e.g. to define search paths to program binaries. There are also many other variables in use for all imaginable purposes under Linux.
Where to define these variables depends on the intended purpose. Either you define variables temporarily. The variable definition is therefore only valid until the next restart. If variables are to be set automatically each time the system is started, they can be entered in the corresponding files. However, the syntax is always the same:VARIABLE = 0815
The command can be used to output the variable content:echo $ VARIABLE 0815
The command ensures that the variable is not only available in the current shell, but also in the programs you have called:export VARIABLE
You can also put all of this in a single line:export VARIABLE = 0815
As I said, such variables only apply to the current session. However, variables can also be defined permanently:
System-wide change for all users see file.
Changes only for one or a few users see file (~ / = home directory of the user).
Environment variables are used when the process is generated inherited, i.e. child processes receive a copy of the environment of the father process and pass this on to their children.
Suppose we also want to have it in the search path - then write in there in a suitable place:PATH = $ PATH: / usr / local / progdir export PATH
This first defines a variable PATH that contains the value of the previous PATH variable at the beginning, followed by a colon and the one appended at the end. With the export command of the shell this variable is then written into the environment.
Incidentally, .bashrc is also possible, but it is unnecessarily time-consuming because the commands it contains are executed every time a bash is started. Since the environment variables are inherited anyway, this is only necessary once for the login shell; all bash processes started below then inherit the settings.export http_proxy = http: //my.proxy.company
This also works in the same way with ftp_proxy.printenv [variable ...]
outputs the value of all or the specified environment variable (s).
The locale environment variables can also be used to set German messages (output and error messages) from programs.
In order to be able to compile KDE programs yourself, various variables have to be set. Here is an example for SuSE 8.X:export KDEDIR = / opt / kde3 export QTDIR = / usr / lib / qt3
Environment variable (last edited 2010-06-18 08:51:28 by p54A142B6)
- What is a black hole 55
- Is hydropower renewable
- Can kitties eat tuna
- What are some facts about MIT
- What is the best treatment for amoeba
- How does constituency parsing work?
- How to check your Iqama status
- Why is Jennifer Lawrence so cute
- Did Jesus gain insight through meditation
- What are CNT applications
- FBS is a good forex broker
- What is the gristle of a steak
- What is the difference between Obfuscate and Perturb
- What goes a long way in life
- How does the banking system work today
- What courses does Cambridge offer
- What is edupacked organization
- What is Dermatophytic Onychomycosis Market Research
- What is the purpose of punitive damages
- Who loves nudes
- How am I like Amy Winehouse
- What is your reason for cutting classes
- What is product safety
- Who is a famous mechanical engineer