While we're at fixing each other's code:
You forgot about the issue of an executable being in $PATH and being executed instead of the shell we are after.| | exec '/bin/csh', '-c', "source env.csh ; perl $0 nested"; | |
As far as an infinite loop is concerned I did state that I am testing for a variable that I know exists and is set in the env.csh file.
Fixing the last two bullet items you are referring to is not covered in fix either AFAICT. Any arguments being passed to the script are going to be lost. To fix that I'd add
exec '/bin/csh', '-c', sprintf("source env.csh ; perl $0 nested %s" +,join(" ",@ARGV));
And believe it or not there are still some ways to break this...
In reply to Re^3: how to set environmental vars
by blue_cowdawg
in thread how to set environment vars
by rsennat
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |