zsh-users
 help / color / mirror / code / Atom feed
From: Stephane Chazelas <stephane@chazelas.org>
To: "René Neumann" <lists@necoro.eu>
Cc: zsh-users@zsh.org
Subject: Re: [Review Request] Arrays and their usage
Date: Tue, 1 Jun 2021 06:59:54 +0100	[thread overview]
Message-ID: <20210601055954.p6bvpbwalbtns5tx@chazelas.org> (raw)
In-Reply-To: <1eb8dc21-eb40-cc32-4ca8-c049d7273a03@necoro.eu>

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


      parent reply	other threads:[~2021-06-01  6:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-30 23:24 René Neumann
2021-05-31  0:28 ` Mikael Magnusson
2021-05-31  4:24   ` Bart Schaefer
2021-05-31 19:41   ` René Neumann
2021-05-31 17:36 ` Stephane Chazelas
2021-05-31 20:04   ` René Neumann
2021-05-31 21:42     ` Bart Schaefer
2021-05-31 21:43     ` Lawrence Velázquez
2021-05-31 22:05       ` René Neumann
2021-06-01  5:59     ` Stephane Chazelas [this message]

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=20210601055954.p6bvpbwalbtns5tx@chazelas.org \
    --to=stephane@chazelas.org \
    --cc=lists@necoro.eu \
    --cc=zsh-users@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).