K
Ken Innes
I'm having a weird problem where accessing the PATH environment
variable overwrites it with a different path. As an example:
/scripts/script1.rb:
#!/usr/bin/ruby
puts `env | grep PATH`
puts ENV["PATH"]
puts `/usr/bin/env | grep PATH`
Command Line:
[testing]% script1.rb
/bin:/usr/bin:/usr/local/bin:.:/scripts
/bin:/usr
PATH=/bin:/usr
[testing]%
I have to put the full path for "env" the second time otherwise I'd
get "sh: env: command not found". And I don't know where the "/usr"
directory comes from. I've searched all the files in my home
directory, and don't see it setting just "/usr" to the path anywhere.
I also searched through the files in the Ruby directory and never see
a "/usr" by itself.
This is a project that I inherited which uses Ruby 1.4.6 on a RedHat
Linux 6.1J. I copied it onto my RedHat Linux 6.1J machine, and
upgraded Ruby to fix the problem. Unfortunately, the scripts are not
quite compatible with the updated Ruby, so I had to revert to the
version that was originally used.
variable overwrites it with a different path. As an example:
/scripts/script1.rb:
#!/usr/bin/ruby
puts `env | grep PATH`
puts ENV["PATH"]
puts `/usr/bin/env | grep PATH`
Command Line:
[testing]% script1.rb
/bin:/usr/bin:/usr/local/bin:.:/scripts
/bin:/usr
PATH=/bin:/usr
[testing]%
I have to put the full path for "env" the second time otherwise I'd
get "sh: env: command not found". And I don't know where the "/usr"
directory comes from. I've searched all the files in my home
directory, and don't see it setting just "/usr" to the path anywhere.
I also searched through the files in the Ruby directory and never see
a "/usr" by itself.
This is a project that I inherited which uses Ruby 1.4.6 on a RedHat
Linux 6.1J. I copied it onto my RedHat Linux 6.1J machine, and
upgraded Ruby to fix the problem. Unfortunately, the scripts are not
quite compatible with the updated Ruby, so I had to revert to the
version that was originally used.