zsh-users
 help / color / mirror / code / Atom feed
From: Kurtis Rader <krader@skepticism.us>
To: Koch <omgoch@gmail.com>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: PATH variable case-insensitive?
Date: Thu, 5 Feb 2015 08:18:19 -0800	[thread overview]
Message-ID: <CABx2=D_oO911JFMvr1kM99qMJOhEVf6X2PybmwncrkhUThocvQ@mail.gmail.com> (raw)
In-Reply-To: <54D39290.9020702@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1311 bytes --]

That is not a bug. It's a feature. See the discussion of "typeset -T" in
"man zshbuiltins". The lower-case version of PATH is an array parameter
bound to the scalar upper-case parameter. The CDPATH parameter has a
similar binding. You can create your own with "typeset -T".

Personally, I like the feature as it allows for more readable and easier to
maintain dot files. For example, in my $HOME/.zshenv I have

_PATH="$PATH"  # save the original path for diagnostic purposes
typeset -U path  # note that -T is implicit for PATH/path
path=(
    ${HOME}/bin
    ${HOME}/sbin
    ${HOME}/symlinks
    /usr/local/bin
    /usr/local/go/bin
    /usr/local/sbin
    /usr/bin
    /usr/sbin
    /bin
    /sbin
    /opt/X11/bin
    )

typeset -U cdpath # note that -T is implicit for CDPATH/cdpath
cdpath=(
    ${HOME}/projects/personal
    ${HOME}/projects/3rd_party
    .
)


On Thu, Feb 5, 2015 at 7:56 AM, Koch <omgoch@gmail.com> wrote:

> Using zsh 5.0.2 (x86_64-pc-linux-gnu) with the following file contents in
> ./test.zsh:
>
> PATH=bar
> path=omg
> echo $PATH
>
> and running zsh ./test.zsh outputs:
> omg
>
> Is this a bug? It's certainly not my intention to have this meaning
> attached to this program, since it goes against POSIX.
>
>


-- 
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank

  reply	other threads:[~2015-02-05 16:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-05 15:56 Koch
2015-02-05 16:18 ` Kurtis Rader [this message]
2015-02-05 16:38 ` Peter Stephenson
2015-02-05 16:54   ` Peter Stephenson
2015-02-05 16:38 ` ZyX

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='CABx2=D_oO911JFMvr1kM99qMJOhEVf6X2PybmwncrkhUThocvQ@mail.gmail.com' \
    --to=krader@skepticism.us \
    --cc=omgoch@gmail.com \
    --cc=zsh-users@zsh.org \
    /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).