* POSIX: reserved words should not expand into aliases
@ 2018-07-15 12:16 Ravi (Tom) Hale
2018-07-15 19:04 ` dana
0 siblings, 1 reply; 2+ messages in thread
From: Ravi (Tom) Hale @ 2018-07-15 12:16 UTC (permalink / raw)
To: zsh-workers
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: POSIX: reserved words should not expand into aliases
2018-07-15 12:16 POSIX: reserved words should not expand into aliases Ravi (Tom) Hale
@ 2018-07-15 19:04 ` dana
0 siblings, 0 replies; 2+ messages in thread
From: dana @ 2018-07-15 19:04 UTC (permalink / raw)
To: Ravi (Tom) Hale; +Cc: zsh-workers
On 15 Jul 2018, at 07:16, Ravi (Tom) Hale <ravi@hale.ee> wrote:
>It seems that both `{ba,z}sh` have a bug here.
>
>How do I access a reserved word if an alias is hiding it?
http://zsh.sourceforge.net/Doc/Release/Options.html#Shell-Emulation
>POSIX_ALIASES <K> <S>
>When this option is set, reserved words are not candidates for alias expansion:
>it is still possible to declare any of them as an alias, but the alias will
>never be expanded. Reserved words are described in Reserved Words.
dana
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-07-15 19:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-15 12:16 POSIX: reserved words should not expand into aliases Ravi (Tom) Hale
2018-07-15 19:04 ` dana
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).