bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: RFE: new syntax for command substitution to keep trailing newlines?


From: pepa65
Subject: Re: RFE: new syntax for command substitution to keep trailing newlines?
Date: Wed, 27 Jan 2021 16:28:18 +0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

On 27/01/2021 16.07, Clark Wang wrote:
> $(|cmd ...) makes more sense for me. '|' is a pipe which means passthrough.
> 
> For future extensions, use
> 
>   $(&flag1[=value1]&flag2[=value2] cmd ...)
> 
> For example,
> 
>   $(&keep_trailing_newlines cmd ...) is just the same as $(|cmd ...).
>   $(&no_fork cmd ...) means the ksh style ${ cmd ... }.

But piping basically connects subshells, and the semantics was supposed
to be "no subshell". Why then not this:

$(; var1=val2 var2=val2 command;)

Because a semicolon normally does not start a subshell, and "$(; ;)" is
more or less a clean and meaningful delimiter. Although it still has the
( ) parentheses which indicate a subshell...

${; var1=val2 var2=val2 command;}

(Confusing for using the "${ }" variable substitution semantics...)

"${{ }}" is then not so bad an option, duplication of brackets to
change/enhance the semantics is already a thing in bash.

Peter



reply via email to

[Prev in Thread] Current Thread [Next in Thread]