For example, I can do this:
JavaScript
x
ENV=dev ruby script.rb
But how can I do this?
JavaScript
USER=aa PASS=bb ruby script.rb
I cannot use this:
JavaScript
export USER=aa
export PASS=bb
ruby script.rb
I have to do it in one line
Advertisement
Answer
As far as I know, every Bourne shell allows any number of name=value pairs preceding the command to establish the environment. Bash certainly does.
JavaScript
$ foo=foo bar=bar env | grep -E 'foo|bar'
foo=foo
bar=bar