[quite ot] scripting an rvm command

Hi All,

sorry for this dumb question, but i'm getting zero iq as of this moment :slight_smile:

i cannot seem to run properly an rvm command inside a script file. my
objective is to run a ruby script on all rvm versions installed.

eg, the ff runs fine when run thru the cli,

聽聽聽for i in `rvm list strings`; do rvm use "$i"; ruby -v; done

but when the above code is placed inside a script file, and then the
script is run, you wont get the expected output. You just the same
ruby -v result on all rvm ruby versions, as if rvm use command was
ignored..

hope i was clear enough.

thank you and kind regards
-botp

ok, ignore. sorry for the noise.

found out that i have to source "$HOME/.rvm/scripts/rvm"
should have read seguin's page in advance.

kind regards -botp

路路路

On Thu, Nov 11, 2010 at 1:47 PM, botp <botpena@gmail.com> wrote:

Hi All,

sorry for this dumb question, but i'm getting zero iq as of this moment :slight_smile:

i cannot seem to run properly an rvm command inside a script file. my
objective is to run a ruby script on all rvm versions installed.

eg, the ff runs fine when run thru the cli,

for i in `rvm list strings`; do rvm use "$i"; ruby -v; done

but when the above code is placed inside a script file, and then the
script is run, you wont get the expected output. You just the same
ruby -v result on all rvm ruby versions, as if rvm use command was
ignored..

hope i was clear enough.

thank you and kind regards
-botp

I just noticed your update, so I deleted more than half my response.
But I wanted to mention that in addition to the ways outlined on that
page, I find that wrapping version changes inside a bash function
works well and is quite handy. Here's one example from a recent
project:

  A quick and dirty solution to run my specs through multiple ruby versions. 路 GitHub

Then in the console, running ./multispec.sh does the job nicely.

Regards,
Ammar

路路路

On Thu, Nov 11, 2010 at 7:48 AM, botp <botpena@gmail.com> wrote:

Hi All,

sorry for this dumb question, but i'm getting zero iq as of this moment :slight_smile:

i cannot seem to run properly an rvm command inside a script file. my
objective is to run a ruby script on all rvm versions installed.

eg, the ff runs fine when run thru the cli,

for i in `rvm list strings`; do rvm use "$i"; ruby -v; done

but when the above code is placed inside a script file, and then the
script is run, you wont get the expected output. You just the same
ruby -v result on all rvm ruby versions, as if rvm use command was
ignored..

yes, the script does work as written verbatim in cli and as shell
function, wc baffled me much why i cannot run it fine inside a script
file. i have in fact now included the sourcing inside the function.
this way i wont forget it :slight_smile:

thanks Ammar for the multispec tip.

best regards -botp

路路路

On Thu, Nov 11, 2010 at 2:12 PM, Ammar Ali <ammarabuali@gmail.com> wrote:

I just noticed your update, so I deleted more than half my response.
But I wanted to mention that in addition to the ways outlined on that
page, I find that wrapping version changes inside a bash function
works well and is quite handy. Here's one example from a recent
project:
A quick and dirty solution to run my specs through multiple ruby versions. 路 GitHub
Then in the console, running ./multispec.sh does the job nicely.