drieux writes: > > On Dec 9, 2003, at 10:09 PM, Pablo Cusnir wrote: > > > Is there a way using Perl to add to the environment > > variable PATH a new path, and that addition will be > > valid after the script is ran and not only for the script's scope. > > I'm working in cshell in Solaris 5.8 > > let me see IF I get your idea. > > I have a command say "add_path" so that > you could do something like > > vladimir: 70:] echo $PATH > /usr/local/bin:/usr/X/bin:/usr/bin > vladimir: 71:] add_path > vladimir: 72:] echo $PATH > /happy/place/here:/usr/local/bin:/usr/X/bin:/usr/bin > vladimir: 73:] > > that's not really going to happen, since you want to > change the environment of the currently running process > by having a sub-process 'signal it'...
I am not a c-shell guy, but in then Bourne shell, or in bash, you could accomplish what you want in a similar fashion thus: # instead of "add_path" being called directly, you can do this: export PATH=`add_path`:$PATH The back-quotes perform what lispers call a "splice macro". The value that is returned on add_path's stdout replaces the text or `add_path` so that it does what you want. So add_path might look something like this: #!/bin/bash # add_path -- return a path to add to PATH echo /some/unusual/path:/another/one:/and/so/forth I know there is a similar construct in csh, but I do not remember what it is. I hope this is at least some help. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>