From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 304 invoked from network); 24 Feb 1998 15:10:35 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 24 Feb 1998 15:10:35 -0000 Received: (from list@localhost) by math.gatech.edu (8.8.5/8.8.5) id JAA14637; Tue, 24 Feb 1998 09:54:51 -0500 (EST) Resent-Date: Tue, 24 Feb 1998 09:54:32 -0500 (EST) From: njs3@doc.ic.ac.uk (Niall Smart) Date: Tue, 24 Feb 1998 14:55:14 +0000 In-Reply-To: Helmut Jarausch "PATH editing in a script" (Feb 24, 2:11pm) X-Mailer: Mail User's Shell (7.2.5 10/14/92) To: Helmut Jarausch Subject: Re: PATH editing in a script Cc: zsh-users@math.gatech.edu Message-Id: Resent-Message-ID: <"Ijuqz1.0.xZ3.eyjyq"@math> Resent-From: zsh-users@math.gatech.edu X-Mailing-List: archive/latest/1339 X-Loop: zsh-users@math.gatech.edu X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu 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