Thursday, May 16, 2024
 Popular · Latest · Hot · Upcoming
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 7244  / 2 Years ago, fri, february 18, 2022, 10:23:43

How do I force the shell I called a script from to reload .bashrc from inside the script?



I'm trying to make a "new box" script that sets everything up the way I like it. Everything works, except for reloading .bashrc.



I know I can "just" do . ~/.bashrc or exec bash or any of the other ways to apply changes after running the script. But it kind of defeats the purpose of making a one-button fix, and coming this far just to get screwed on the last step is driving me nuts lol






I've tried adding all of the source ~./bashrc exec bash stuff to the script, but no joy since it is only reloading it for the script's environment, not the calling shell



I'm still fairly new so it's probably something super obvious which would explain why I couldn't googlefu the answer >.<



any help would be much appreciated.


More From » bash

 Answers
5

This might not work for everything. And may be doing something I shouldn't be doing.. but for my purposes it gets the job done.



For script.sh if i call it by . script.sh instead of bash script.sh everything seems to run and update accordingly.



Yay!


[#6686] Saturday, February 19, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
odyroc

Total Points: 324
Total Questions: 109
Total Answers: 103

Location: Belize
Member since Mon, Apr 17, 2023
1 Year ago
;