James Evans
James Evans

Reputation: 795

how to get options passed before ruby executable?

suppose this command:

FOO=bar BAR=foo executable --args

when executable is a bash script i just get opts by names, $FOO, $BAR etc.

how to get them if executable is a ruby script?

Upvotes: 0

Views: 81

Answers (1)

Sergio Tulentsev
Sergio Tulentsev

Reputation: 230346

These "options" are environment variables and, therefore, they are available through ENV. Try this:

puts ENV['FOO'] # => bar

Upvotes: 2

Related Questions