Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [Review Request] Arrays and their usage
2021-05-31 22:04:44 +0200, René Neumann:
[...]
> > makepkg --printsrcinfo |
> > sed -n 's/pkgname = //p'
[...]
> (NB though: The linebreak for the two pipe elements was inserted for this
> email only, with me hoping, that backslash newline was the correct thing to
> do ;))
[...]
\ in front a a newline removes the newline before the parser
interprets the code but here, a newline is fine, same as after
||, &&, ;, &, if, then, else, while, do... You can even have
comments:
set -o pipefail
print -P - $var | # prompt
# expansion
sed 's/^[[:blank:]]*//' | # trim leading blanks
wc -c ||
die "pipeline failed"
At the prompt of an interactive shell, you'll notice that if you
press enter after a pipe, you see:
$ echo foo |
pipe>
Which tells you the parser is still expecting a command after
that |.
Where you might argue it's inconsistent is that you don't get
something similar after redirection operators:
$ echo foo >
zsh: parse error near `\n'
Or after "for"/"select"/"repeat"
$ for
zsh: parse error near `\n'
It's not specific to zsh though.
--
Stephane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author