M
M
mad_DOG2015-05-06 10:00:59
linux
mad_DOG, 2015-05-06 10:00:59

What is the best way to create a global environment variable in linux?

need to create a global environment variable in linux [debian based distro] via setup script

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
AVKor, 2015-05-06
@mad_DOG

1 , 2 .

3
3vi1_0n3, 2015-05-06
@3vi1_0n3

Write it down in /etc/environment, there is nowhere more global

A
Anton Kotler, 2021-11-06
@kotler-dev

Create temporary variable (local):

TEST_VAR=value
echo $TEST_VAR

Install "globally":
echo "export TEST_VAR='value' " >>  ~/.bashrc
source ~/.bashrc

Check:
env | grep TEST_VAR

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question