My ruby script requires connection to an Oracle database. So I need to export ORACLE_HOME and LD_LIBRARY_PATH correctly before the script would run. Is there a way that I can export those env variables without using shell script? I tried to put ENV['ORACLE_HOME'] = '/usr/local/oracle_client' at the first line of the script and it doesn't work. Now the only way it would work is to write a shell script, where export those variables and then run ruby there. The shell script looks like:
export ORACLE_HOME='/usr/local/oracle_client' export LD_LIBRARY_PATH='/usr/local/oracle_client/lib' ruby myscript.rb --options
It's kinda ugly because user has to go inside the shell script to change options. I'm wondering whether there's a better way of doing it. So user can just do at command line: ruby myscript.rb --options