zsh-users
 help / color / mirror / code / Atom feed
From: njs3@doc.ic.ac.uk (Niall Smart)
To: Helmut Jarausch <jarausch@igpm.rwth-aachen.de>
Cc: zsh-users@math.gatech.edu
Subject: Re: PATH editing in a script
Date: Tue, 24 Feb 1998 14:55:14 +0000	[thread overview]
Message-ID: <E0y7LlK-0000yV-00@oak71.doc.ic.ac.uk> (raw)
In-Reply-To: Helmut Jarausch <jarausch@igpm.rwth-aachen.de> "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


             reply	other threads:[~1998-02-24 15:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-02-24 14:55 Niall Smart [this message]
  -- strict thread matches above, loose matches on Subject: below --
1998-02-24 13:11 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E0y7LlK-0000yV-00@oak71.doc.ic.ac.uk \
    --to=njs3@doc.ic.ac.uk \
    --cc=jarausch@igpm.rwth-aachen.de \
    --cc=zsh-users@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).