The bash_profile
usually modifies the bash environment (installing functions, aliases, variables, readline bindings, etc.), and there is really no way to modify the environment of a parent bash process.
So the best you can do is end the ruby script by exec
ing a new bash, specifying the -l
(or --login
) option to make it a login shell so that it will start by sourcing bash_profile
. (You can also do this by making the first character of argument -
, usually by setting it to -bash
.)
If you have control over the way the ruby script is initiated, you might be able to cause it to be exec
ed, in order that it replaces the parent bash process. That will make for a cleaner process tree.