[quite ot] scripting an rvm command

B

botp

Hi All,

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

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
 
B

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
 
A

Ammar Ali

Hi All,

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

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,

=C2=A0 for i in `rvm list strings`; do rvm use "$i"; ruby -v; =C2=A0done

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

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:

https://gist.github.com/672097

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

Regards,
Ammar
 
B

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:
=A0https://gist.github.com/672097
Then in the console, running ./multispec.sh does the job nicely.

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 :)

thanks Ammar for the multispec tip.

best regards -botp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,150
Latest member
MakersCBDReviews
Top