0

I have a script which modifies several things in bash_profile. I want a to reload bash_profile after my script terminates.

The main idea is to be able to use the same terminal without any additional actions (manually sourcing bash_profile) right after termination of script.

P.S. I know how to source bash_profile manually and programatically. The main problem that if I source it in the script it modify environment only for script itself (and not the terminal in which it was run)

Update 1

The script is run on freshly installed OS X. As result, bashrc and bash_profile can't be modified BEFORE script runs.

Victor Ronin
  • 21,988
  • 17
  • 90
  • 178

1 Answers1

0

You can add a wrapper function for your script to .bashrc:

myscript() { /path/to/myscript && . ~/.bash_profile; }
glenn jackman
  • 223,850
  • 36
  • 205
  • 328