Timeline for Refresh env variables after editing bashrc file
Current License: CC BY-SA 3.0
13 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Oct 27, 2020 at 1:31 | comment | added | Taha Rehman Siddiqui | This only adds the newly added variables, but doesn't remove the variables removed in bashrc file. | |
| Jul 3, 2020 at 7:08 | comment | added | Ryan | This is NOT EQUIVALENT. You are EXECUTING A COMMAND WITHIN THIS PROCESS. THIS CREATES A CHILD PROCESS IN THE MEMORY. It may be functionally the same for the user's assumed needs, but NEVER ASSUME THE NEEDS OF THE USER when there is a technical difference that could come back to confuse the user. The user will not be pleased when he/she has to type the "exit" command two times at the end of his/her terminal session, and wonders why this is so. | |
| Nov 9, 2017 at 11:04 | comment | added | waldyrious | To complement @lesmana's comment, it is possible to start a new child shell via bash that does start out with a clean environment, using env -i bash. From the env manpage: -i, --ignore-environment --> start with an empty environment | |
| Jun 22, 2016 at 11:04 | comment | added | Kusalananda♦ | exec bash or exec bash -l will be equivalent. @toogley | |
| Jun 22, 2016 at 10:38 | comment | added | uuu | @n0pe This is equivalent to closing the window and re-opening a new one. i don't think that is true, because the new bash shell is executed inside the old, therefore the old doesn't die. Instead when closing a terminal, the bash session of that terminal is killed, therefore in your GUI exacmple there does only one bash exist afterwards. | |
| Dec 23, 2015 at 10:35 | comment | added | Lanti | For some reason source not working in a a shell script inside an if else statement. Is it possible to fix this? | |
| Dec 15, 2011 at 2:27 | comment | added | jw013 | @MaxMackie Considering how source is a bashism that is longer to type yet offers no advantages over its portable across all shells equivalent, ., I don't see the point of encouraging anyone, new or experienced, to use it. | |
| Dec 13, 2011 at 20:57 | comment | added | Lesmana | note that merely sourcing bashrc is not necessarily equal to a restart of bash. defined variables are not automatically undefined. shell options are not automatically unset. sourcing bashrc only executes what is written in bashrc. it does not rollback any other changes in the environment. starting a new bash session inside the old is also not necessarily equal to a restart of bash, as the new process inherits the environment from the old. | |
| Dec 13, 2011 at 7:04 | vote | accept | xiaohan2012 | ||
| Dec 13, 2011 at 6:34 | comment | added | nopcorn | @Rush typing source shows the user which command is called. I don't believe in showing the shorthanded commands to new users until they understand what the code is doing. | |
| Dec 13, 2011 at 6:31 | comment | added | rush | also there is no need to type long word source. you can just type dot instead of it: . ~/.bashrc. | |
| Dec 13, 2011 at 6:18 | comment | added | Matteo | No need to execute another shell. source is the correct way | |
| Dec 13, 2011 at 5:44 | history | answered | nopcorn | CC BY-SA 3.0 |