zsh-workers
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@brasslantern.com>
To: zsh-workers@math.gatech.edu
Subject: Re: env variables
Date: Mon, 4 May 1998 03:41:03 -0700	[thread overview]
Message-ID: <980504034103.ZM3129@candle.brasslantern.com> (raw)
In-Reply-To: <slrn6kqe41.a1r.mason@coral.primenet.com.au>

On May 4,  3:39am, Geoff Wing wrote:
} Subject: Re: env variables
}
} Nik Gervae <Nik@pdi.com> typed:
} :> Arrays aren't exported, because there's no standard or de facto
} :> method of exporting arrays, so nothing would understands them
} :Hmm. That sounds slightly fishy in that csh happily exports array
} :variables, but then csh is bogus in so many ways....
}
} Not as arrays. In fact, I can't see it doing it at all.

The problem is not really with exporting arrays ... the problem is with
exporting a variable whose name happens to be the same as one of zsh's
special array variables.

In the case in question, some program wants a variable named "cdpath" to
be in the environment.  It probably expects that to be a colon-separated
string, but it doesn't really matter what it expects, because zsh won't
put a variable named "cdpath" in the environment.  It actively removes
such a variable from the environment if it happens to be there when the
shell starts up.

This is one reason I've always preferred csh's model of keeping local
and environment variables in completely separate namespaces.  (The icky
bit about the csh model is that you still refer to both with $xxx, so
you can't tell what namespace you're referencing.)  (No, zsh should not
change models.)

The only workaround is to export the variable for a single command only,
like so:

	cdpath=$CDPATH printenv

In older versions of zsh, that would have clobbered both cdpath and CDPATH
for the current shell, but fortunately that's fixed in current releases
so you can use it safely.

Hmm; hey, Peter, another FAQ entry?

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


  reply	other threads:[~1998-05-04 10:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-04-30 20:56 Timothy Doyle
1998-04-30 23:01 ` Nik Gervae
1998-05-01  5:22 ` Geoff Wing
1998-05-01 17:21   ` Nik Gervae
1998-05-01 19:47     ` Geoff Wing
1998-05-01 20:44       ` Nik Gervae
1998-05-04  3:39         ` Geoff Wing
1998-05-04 10:41           ` Bart Schaefer [this message]
1998-05-04 17:01           ` Nik Gervae
     [not found]       ` <74885733@toto.iv>
1998-05-05  0:52         ` Nik Gervae

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=980504034103.ZM3129@candle.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@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).