Den 10 Aug 2009 16:57:42 GMT skrev Glenn Jackman:
> At 2009-08-07 06:53PM, "David Masover" wrote:
>>  On Friday 07 August 2009 02:55:11 pm Glenn Jackman wrote:
>> > Since Ruby is not Bash, you have to parse the file:
>> >
>> >     File.foreach("myenv") do |line|
>> >       line.chomp.scan(/^export (.+?)=(.*)$/) do |name, val|
>> >         ENV[name] = val
>> >       end
>> >     end
>> >
>> >     p ENV['FOO']  # => "bar"
>>  
>>  That's pretty fragile -- it would severely limit what you can put in
>>  the file.
>
> I don't understand this comment.  How is it "severely limiting"?
>
> Granted, it won't properly parse
>     export a=b c=d e=f foo bar
> and I didn't account for extra whitespace.  The OP didn't specify any
> such requirements though.
>
> But it's not going to get tripped up by any line that doesn't match the
> pattern.  It won't run off and execute any of the other commands in this
> bash file.
>
> I'm not personally offended by your comments, I'm curious to learn more.

A couple of lines from my .profile:

export PATH=${HOME}/bin:${PATH}
source ${HOME}/.bashrc
if [ -z "$COLORTERM" ]
then
        export EDITOR=vi
fi

/Kent
-- 
"The Brothers are History"