Saturday, May 18, 2024
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 1785  / 1 Year ago, thu, may 4, 2023, 11:15:27

I am basically using .bashrc for adding environment variables. Each time I add a new Environment variable, I have to log out the current session and log in again to bring the changes in effect.



Is there any way where I can add environment variable and continue working without restarting the session ?



[I think I am clear with my question. If more information is needed, please let me know]



Any help is highly appreciated. :)



(Ubuntu 14.04 - 32-bit)


More From » environment-variables

 Answers
3

Try source ~/.bashrc, or . ~/.bashrc. Both are the same in bash, and will update you ENV variables.



Example:



export $FOO=bar
echo $FOO
bar
echo "FOO=test" >> ~/.bashrc
. ~/.bashrc
echo $FOO
test

[#23956] Thursday, May 4, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ntlesslving

Total Points: 123
Total Questions: 109
Total Answers: 113

Location: South Korea
Member since Fri, Sep 11, 2020
4 Years ago
;