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

Re: [[ is being treated as a pattern in the command/reserved word position.



29.03.2015, 00:14, "Eric Cook" <llua@xxxxxxx>:
> With a recent build, this happens to me. Does it happen for anyone else?
>
> % type [[
> zsh: bad pattern: [[

This is expected: you open a collection, but do not close it.

> % type '[['
> [[ is a reserved word
> % '[[' a == a ]]
> zsh: = not found

`[[` is *not* a command. Neither it is a shell builtin. It is an extension to the shell syntax. So this is expected as well. You see exactly this error message because `=tty` expands to `/usr/bin/tty`.

> % '[[' a '==' a ]]
> zsh: command not found: [[

Same, but you got rid of `==` error.

> % print $ZSH_PATCHLEVEL
> zsh-5.0.7-0-g208bded

`[[` is a *syntax extension* which works *only* if `[[` (literally) occurs in command position. In first commented case you violate “in command position condition”, in other commented cases you violate “literally”.



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