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

Re: what is truth?



On Fri, Oct 9, 2015 at 9:16 PM, Kurtis Rader <krader@xxxxxxxxxxxxx> wrote:

> The redirection characters "<" and ">" are apparently still interpreted as
> such even within a "[[ ]]" construct. Or something very similar is
> occurring. Replace the dash with "x":
>
> [[ '<->' = <x> ]] && echo true
>
> You'll get the error "zsh: parse error: condition expected: '<->'". If you
> quote the right-hand side of that expression you get the expected behavior
> (with the original dash or the "x"). If you want to literally match "<->"
> then put it inside single or double quote characters.
>

Oy Vey! After seeing the responses from Mikael and Bart I realized that I
did not know about the pattern <[x]-[y]> as documented under "Glob
Operators" in the "man zshexpn" documentation. Which itself surprises me
since I've been a programmer since 1978 and fell in love with UNIX a couple
of years later.

This reinforces my belief that zsh, and to a lesser degree other shells
such as ksh, have enough idiosyncratic behaviors that they should not be
used where non-trivial semantics are relevant.

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


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