zsh-workers
 help / color / mirror / code / Atom feed
* comments in command/process substitution and (z) PE
@ 2018-01-26  1:05 Matthew Martin
  0 siblings, 0 replies; only message in thread
From: Matthew Martin @ 2018-01-26  1:05 UTC (permalink / raw)
  To: zsh-workers

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-01-26  1:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-26  1:05 comments in command/process substitution and (z) PE Matthew Martin

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).