You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On Usenet in comp.unix.shell, Janis Papanagnou
<[email protected]> reported:
> With syntax-check ('ksh -n') I get a warning in Ksh for this
> expression
>
> "${pipe#* | }"
>
> concerning the pipe symbol. (Bash and Zsh don't complain.)
>
> (2709)$ ksh -n -c '"${pipe#* | }"'
> ksh: warning: line 1: | within ${} should be quoted
> (2710)$ ksh -n -c '"${pipe#* [|] }"'
> ksh: warning: line 1: | within ${} should be quoted
> (2711)$ ksh -n -c '"${pipe#* \| }"'
This is very strange. Neither POSIX nor any existing shell requires
'|' to be quoted in that context. ksh also works fine without
quoting it.
In lexstates.h, we find a clue to the reason:
#define S_META 35
/* | & ; < > inside ${...} reserved for future use */
Those AT&T plans for future use (whatever they might have been)
never materialised, and I have no such plans -- particularly as
requiring quoting there to avoid hypothetical new features would be
a backward incompatibility with POSIX and with historic ksh usage.
A look at ast-open-archive shows that these had been 'reserved for
future use' since the earliest version of that repo, so since
1995-08-28 or before. Yet another thing AT&T simply forgot about.
src/cmd/ksh93/sh/lex.c,
src/cmd/ksh93/data/lexstates.c,
src/cmd/ksh93/include/lexstates.h:
- sh_lex(): Remove the warning in question, e_lexusequote
(separately for ';' and the other four).
- Remove e_lexusequote message with the text for that warning.
- Remove S_META state, which was only used in the ST_NESTED state
table for this warning.
- Remove nested_tilde flag from the lexd struct, which was used to
avoid the warning within ~(...) (pattern options) within ${...}.
Further discussion:
https://comp.unix.shell.narkive.com/H5Rfs3q8/ksh-warning-pipe-symbol-within-should-be-quoted
0 commit comments