zsh-workers
 help / color / mirror / code / Atom feed
From: Vin Shelton <acs@alumni.princeton.edu>
To: zsh-workers@sunsite.dk
Subject: typeset -U within a function
Date: 09 Nov 2001 21:29:55 -0500	[thread overview]
Message-ID: <m2snbn73z0.fsf@zion.rcn.com> (raw)

>From either zsh-4.0.4 or from the latest CVS sources, when I create a
function like this:

function bar {
  typeset -U PATH
  PATH=/xxx:/yyy
}

and then run it, PATH is unchanged:

  zion% /usr/local/zsh-4.0.4/bin/zsh -f
  zion% function bar {
  function> typeset -U PATH
  function> PATH=/xxx:/yyy
  function> }
  zion% echo $PATH
  /home/acs/bin:/usr/local/bin:/usr/X11R6/bin:/bin:/usr/bin:/etc
  zion% bar
  zion% echo $PATH
  /home/acs/bin:/usr/local/bin:/usr/X11R6/bin:/bin:/usr/bin:/etc

If I remove the 'typeset -U PATH' line (even if PATH already had been
'typeset -U' before entering the function), the value of PATH is
changed by the function bar:

  zion% function bar {
  function> PATH=/xxx:/yyy
  function> }
  zion% echo $PATH
  /home/acs/bin:/usr/local/bin:/usr/X11R6/bin:/bin:/usr/bin:/etc
  zion% bar
  zion% echo $PATH
  /xxx:/yyy


  - vin


             reply	other threads:[~2001-11-10  2:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-10  2:29 Vin Shelton [this message]
2001-11-10  7:21 ` Borsenkow Andrej
2001-11-10 14:13   ` Vin Shelton

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=m2snbn73z0.fsf@zion.rcn.com \
    --to=acs@alumni.princeton.edu \
    --cc=zsh-workers@sunsite.dk \
    /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).