zsh-workers
 help / color / mirror / code / Atom feed
From: Matthew Martin <phy1729@gmail.com>
To: zsh-workers@zsh.org
Subject: comments in command/process substitution and (z) PE
Date: Thu, 25 Jan 2018 19:05:41 -0600	[thread overview]
Message-ID: <20180126010540.GA21108@CptOrmolo.darkstar> (raw)

zshmisc(1) documents for comments:

    In non-interactive shells, or in interactive shells with the
    INTERACTIVE_COMMENTS option set, a word beginning with the third
    character of the histchars parameter (`#' by default) causes that
    word and all the following characters up to a newline to be ignored.

` command substituion prematurely ends comments, and (z) reflects that.

    % setopt interactivecomments
    % echo `echo foo #bar` baz
    foo baz
    % print -l ${(z)${:-'echo `echo foo #bar` baz'}}
    echo
    `echo foo #bar`
    baz

$( command substitutions and parameter substitutions correctly do not
terminate the comment until the newline, but (z) PE parses the line
incorrectly.

    % echo $(echo foo #bar) baz
    cmdsubst>

    % print -l ${(z)${:-'echo $(echo foo #bar) baz'}}
    echo
    $(echo foo #bar)
    baz

    % cat < <(echo foo #bar) baz
    cmdsubst>

    % print -l ${(z)${:-'cat < <(echo foo #bar) baz'}}
    cat
    <
    <(echo foo #bar)
    baz

- Matthew Martin


                 reply	other threads:[~2018-01-26  1:05 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20180126010540.GA21108@CptOrmolo.darkstar \
    --to=phy1729@gmail.com \
    --cc=zsh-workers@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).