Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATH editing in a script
- X-seq: zsh-users 1339
- From: njs3@xxxxxxxxxxxx (Niall Smart)
- To: Helmut Jarausch <jarausch@xxxxxxxxxxxxxxxxxxx>
- Subject: Re: PATH editing in a script
- Date: Tue, 24 Feb 1998 14:55:14 +0000
- Cc: zsh-users@xxxxxxxxxxxxxxx
- In-reply-to: Helmut Jarausch <jarausch@xxxxxxxxxxxxxxxxxxx> "PATH editing in a script" (Feb 24, 2:11pm)
On Feb 24, 2:11pm, Helmut Jarausch wrote:
} Subject: PATH editing in a script
> Hi,
> does anybody know how to edit the PATH environment variable?
> Something like 'vared' but in a script (like sed)
>
> Problem:
>
> Having two versions of (say) TeX I would like to replace the PATH to tex
> in a user PATH environment string.
>
> Like
> s|/usr/local/lib/TeX|/usr/local/teTeX|
>
> It's no problem to edit the PATH e.g. by Perl but these changes have to
> persist whence the (Perl/Zsh) script finishes.
As someone has already pointed out, the environment list resides in a
processes address space and you can't easily go poking around in another
processes address space to change it.
One technique I've seen used is:
alias foo="eval `foo.real`"
foo.real:
#!/bin/sh
echo export PATH=$PATH | sed 's,/usr/local/lib/TeX,/usr/local/teTeX,g'
Niall
Messages sorted by:
Reverse Date,
Date,
Thread,
Author