Setting Environmental Variables in Ruby script

  • Thread starter jackster the jackle
  • Start date
J

jackster the jackle

I have a scipt that executes a shell command that requires my
environment to be set so the script fails. Is there a way to add my
profile settings into my ruby script?

Thanks

jack
 
S

Sebastian Hungerecker

jackster said:
I have a scipt that executes a shell command that requires my
environment to be set so the script fails. Is there a way to add my
profile settings into my ruby script?

ENV["varname"] = "value"

HTH,
Sebastian
 
A

ara.t.howard

I have a scipt that executes a shell command that requires my
environment to be set so the script fails. Is there a way to add my
profile settings into my ruby script?

Thanks

jack


cfp:~ > cat this-is-a-bash-question.sh
#! /bin/bash --login

echo $FOO



cfp:~ > ./this-is-a-bash-question.sh

(nothing)



cfp:~ > grep FOO .bash_profile

(nothing)


cfp:~ > echo 'export FOO=42' >> .bash_profile



cfp:~ > ./this-is-a-bash-question.sh
42


a @ http://codeforpeople.com/
 
J

jackster the jackle

Sebastian said:
jackster said:
I have a scipt that executes a shell command that requires my
environment to be set so the script fails. Is there a way to add my
profile settings into my ruby script?

ENV["varname"] = "value"

HTH,
Sebastian

Thanks Sebastian...my ruby script takes all the variables without error
but my script still fails so I must be missing something in my
environment still. I'll have to do some more checking....thanks again

jack
 

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,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top