zsh-users
 help / color / mirror / code / Atom feed
* PATH editing in a script
@ 1998-02-24 13:11 Helmut Jarausch
  1998-02-24 13:31 ` Bruce Stephens
  1998-02-24 14:28 ` Bernd Eggink
  0 siblings, 2 replies; 6+ messages in thread
From: Helmut Jarausch @ 1998-02-24 13:11 UTC (permalink / raw)
  To: zsh-users

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.

Thanks for any hints,
Helmut.







^ permalink raw reply	[flat|nested] 6+ messages in thread
* Re: PATH editing in a script
@ 1998-02-24 14:55 Niall Smart
  0 siblings, 0 replies; 6+ messages in thread
From: Niall Smart @ 1998-02-24 14:55 UTC (permalink / raw)
  To: Helmut Jarausch; +Cc: zsh-users

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~1998-03-03 11:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-02-24 13:11 PATH editing in a script Helmut Jarausch
1998-02-24 13:31 ` Bruce Stephens
1998-02-24 14:28 ` Bernd Eggink
1998-03-02  1:06   ` Hank Hughes
1998-03-03 10:31     ` Bernd Eggink
1998-02-24 14:55 Niall Smart

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).