Sujet : Re: [ksh] Warning: pipe symbol within ${} should be quoted?
De : martijn (at) *nospam* inlv.demon.nl (Martijn Dekker)
Groupes : comp.unix.shellDate : 09. Jun 2025, 02:17:38
Autres entêtes
Message-ID : <mamr1iF15c5U1@mid.individual.net>
References : 1 2 3
User-Agent : Mozilla Thunderbird
Op 30-05-2025 om 23:30 schreef Janis Papanagnou:
On 30.05.2025 21:52, Martijn Dekker wrote:
Op 08-05-2025 om 00:00 schreef Janis Papanagnou:
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.)
>
But bash and zsh don't offer linter functionality with -n at all, do they?
I don't know what they internally do when '-n' is provided, but the
man page (e.g. "man bash") says for the 'set' command (-n/-o noexec)
-n Read commands but do not execute them. This may be used
to check a shell script for syntax errors. This is ignored
by interactive shells.
which appears to be the same as what's written in the Ksh man page
(and in POSIX), and I suppose a similar thing valid for Zsh.
Yes, they all check for syntax errors, but (AFAIK) ksh93 is the only shell that goes beyond that and also provides warnings for things that are not syntax errors -- anything from deprecated syntax like backtick command substitutions, to the performance of $((x)) vs $(($x)).
-- || modernish -- harness the shell|| https://github.com/modernish/modernish|||| KornShell lives!||
https://github.com/ksh93/ksh