Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: grammar
- X-seq: zsh-users 30605
- From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: grammar
- Date: Wed, 29 Apr 2026 17:10:19 +0100 (BST)
- Archived-at: <https://zsh.org/users/30605>
- Feedback-id: 20260429-p.w.stephenson@xxxxxxxxxxxx:oxsmtp-prd-nl-vmo:Authrelay:p.w.stephenson@xxxxxxxxxxxx
- Importance: Normal
- In-reply-to: <31418d97-46fa-4ccb-8025-802b90062ba6@eastlink.ca>
- List-id: <zsh-users.zsh.org>
- References: <31418d97-46fa-4ccb-8025-802b90062ba6@eastlink.ca>
> On 29/04/2026 16:59 BST Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
> I was going thru some old stuff and I came across something like this:
>
> % if [[ $path ]] echo $path
>
> ... it works, which makes me uncomfortable because it ain't good grammar.
You're basically correct, yes, it's an abbreviation. Not entirely
logically, it's allowed by the SHORT_LOOPS option.
% if [[ -n string ]] echo string is stringy
string is stringy
% setopt noshortloops
% if [[ -n string ]] echo string is stringy
zsh: parse error near `echo'
%
If you want to be purist you can turn that off, although of course it
does have other consequences.
pws
Messages sorted by:
Reverse Date,
Date,
Thread,
Author