Home linux How to set the environment variable in Linux / Unix?

How to set the environment variable in Linux / Unix?

Author

Date

Category

You need to open the console and execute the

command

export var_name = var_value

This variable will exist within the framework of this process and all processes generated by the data. In order for this variable to be visible in all processes, you must open the configuration file and add a line

export var_name = var_value

If the Bash shell uses, the configuration file will be .bashrc.


Answer 1, Authority 100%

Set the variable only for the current shell

var_name = var_value

for the current shell and all processes formed by it:

export var_name = var_value

only for the new process started:

var_name = var_value new_programm_to_launch

Answer 2, Authority 36%

sh, bash = export var = value
TSCH, CSH = Stenv Var Value

Answer 3, Authority 27%

In many distributions there are /etc/profile.d , files from which are performed when the Shell is initialized if environment variables are associated with some application, it is better to enable the file for / etc /Profile.d with setting environment variables to the application package or create it there manually.

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions