Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATH editing in a script



jarausch@xxxxxxxxxxxxxxxxxxx said:
> 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. 

You can't.  Environment variables are local to processes (and may get 
inherited by child processes, but that doesn't help here).

You can do something like (warning: untested code ahead):

PATH=$(echo $PATH | sed 's|/usr/local/lib/TeX|/usr/local/teTeX|')

You could stick this in a shell function (possibly autoloaded) or an alias.




Messages sorted by: Reverse Date, Date, Thread, Author