Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATH variable case-insensitive?



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@xxxxxxxxx> 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


Messages sorted by: Reverse Date, Date, Thread, Author