From: Esen Sagynov Date: 2010-08-03T11:30:17+09:00 Subject: ENV['someapp']" is nil when the code is run with "sudo" Hi, Some very weird behavior is happening with Ruby when I run the code with "sudo" command. Let's say I have the following code in "myex.rb" source file: ----------------------------- if ENV["CUBRID"] puts "ENV[CUBRID] is: '#{ENV["CUBRID"]}'" else puts "$CUBRID_BROKER is not defined. Possibly you have not installed CUBRID Database yet." end ----------------------------- I have installed the CUBRID Database, and when I run the code by typing "ruby myex.rb" I correctly receive the path where CUBRID has been installed. ----------------------------- ENV[CUBRID] is: '/home/esen/programfiles/CUBRID' ----------------------------- However, when I run this code with "sudo" at the beginning like "sudo ruby myex.rb", the "ENV['CUBRID']" is actually nil, thus, returns the second string in the else block. Can anyone explain why "sudo" neglects all ENVironmental variables? -- Posted via http://www.ruby-forum.com/.