Simon Strandgaard wrote:
> 
> On Thu, 10 Apr 2003 17:46:45 +0000, Peter Ensch wrote:
> 
> > What am I doing wrong here?
> >
> > ENV["PATH"].split(':').each { |i|
> >   puts i
> >   # do more stuff here
> > }
> >
> > My PATH env. variable is a long list of ':' separated
> > paths; however ENV['PATH'] only sees the first path.
> >
> > So, the 'split' works fine, it's the initial string I'm
> > splitting that is the problem.
> 
> It works fine for me. Both with double/single quotes.
> 
> How does you initial string looks ?
> 
> in the "# do more stuff here" section, are you calling break ?
> 

What I'm trying to do is find the path to a certain program on my
system, like

@@cleartool = String.new('')
ENV["PATH"].split(':').each { |path|
  @@cleartool = "#{path}/cleartool" if
FileTest.exist?("#{path}/cleartool")
}

The problem is that ENV['PATH'] doesn't contain what I expect. When I
run env in
my c shell, I get a line like this:

PATH=/home/pensch/apps/usr/local/bin:/home/pensch/apps/htmldoc/bin:/home/pensch/bin:/apps/java/j2re1.4.1_01/bin....

so splitting on ':' I feel should get the paths I want. However, running
the script 
on Solaris w/ C shell, ENV['PATH'] doesn't contain this string

puts ENV['PATH'] prints '/home/pensch'

The same script on my Linux box (bash) gets the expected result.

I'm stumped. Any ideas?
P



-- 

***********************************************
Peter Ensch,
pensch / ti.com           A-1140   (214) 480 2333
***********************************************