From: "Ravi (Tom) Hale" <ravi@hale.ee>
To: zsh-workers@zsh.org
Subject: POSIX: reserved words should not expand into aliases
Date: Sun, 15 Jul 2018 19:16:00 +0700 [thread overview]
Message-ID: <d5990798-7ab4-746f-8f88-81b51e8551c6@hale.ee> (raw)
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
next reply other threads:[~2018-07-15 12:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-15 12:16 Ravi (Tom) Hale [this message]
2018-07-15 19:04 ` dana
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d5990798-7ab4-746f-8f88-81b51e8551c6@hale.ee \
--to=ravi@hale.ee \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).