I'm trying to build a script that automates the sourcing of multiple
bash alias files using ruby.  I'm running into problems in that it while
my alias files get run, the terminal session doesn't recognize any of
the aliases that were set.

I'll use a simple example to be more clear:

My original .bash_rc originally looked like this:

. ~/.bash_aliases

My .bash_aliases was a simple test:

alias rt="echo the rt alias worked"
echo the alias file was run


When I source directly with

. ~/.bash_rc

The alias gets set, I see the message 'the alias file was run' and the
rt command works as expected.  So, every bash terminal session has
access to rt.  Great.  Awesome.  That's how it should work.

However, I want to set aliases using Ruby.  I change my .bash_rc

from: . ~/.bash_aliases

to: ruby ~/set_aliases.rb

My set_aliases.rb looks like this:

system "source ~/.bash_aliases"

Now, each terminal session I open actually runs the file.  I know this
because I get the message 'the alias file was run'.  However, the
terminal session doesn't have access to the rt alias (command unknown).

I'm thinking that the problem has to do with the process context that
the aliases are set in, but I don't know how to fix the problem.

Any ideas would be greatly appreciated.  Thanks.

-- 
Posted via http://www.ruby-forum.com/.