Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
POSIX: reserved words should not expand into aliases
- X-seq: zsh-workers 43173
- From: "Ravi (Tom) Hale" <ravi@xxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: POSIX: reserved words should not expand into aliases
- Date: Sun, 15 Jul 2018 19:16:00 +0700
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; bh=0M3/alLrbljivm+kemBpKjSzF3OXn U5a/gS9WExDV+o=; b=ZomW8i+xBVaBFuDq2anMV5y8hRsz3kDgrV3gGIC0WEqJr AldbAXTxOwNSI0jW+worU9O1VHp6xinsxN6BCd5iuUWpUPXTatR05KemojJjuCVW rfzHGvf/r/YGDHVWRA/W3EVi1yP1duZVe+bDbbht31TCDmZfbyeEs5+oqrWE+g86 5QIO4n3VFapbdqD25GO2oUfi4S5LS7Oh9Cvb3/Qa6QaWswiswQzU+0Xoz79oky+m 4Ha5tpkS59Z6Wgyzm3ODE10RyKUtmDuVc8CZ9u2JNRjZkuyol6105yN2wJd4p/EV OsqIbaRmNllI6NwLBAxnvB2OcZ8kL630zLKhNTIXg==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
The [POSIX Shell Command Language section
2.3.1](http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_03_01)
says:
> However, reserved words in correct grammatical context shall not be
candidates for alias substitution.
It seems that both `{ba,z}sh` have a bug here.
How do I access a reserved word if an alias is hiding it?
Here `if` works normally:
% if : ; then echo true; fi
true
After aliasing `if`:
% alias if=date
% if : ; then echo true; fi
zsh: parse error near `then'
Prefixing with `builtin` or `\` doesn't help:
% builtin if : ; then echo true; fi
zsh: parse error near `then'
% \if : ; then echo true; fi
zsh: parse error near `then'
How do I access a reserved word in the pathological case that it hidden
by an alias?
Prior art: https://unix.stackexchange.com/q/456408/143394
Messages sorted by:
Reverse Date,
Date,
Thread,
Author