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: Clark Wang
Subject: Re: RFE: new syntax for command substitution to keep trailing newlines?
Date: Wed, 27 Jan 2021 17:07:09 +0800

On Wed, Jan 27, 2021 at 4:40 PM Clark Wang <dearvoid@gmail.com> wrote:

> On Wed, Jan 27, 2021 at 12:14 PM Clark Wang <dearvoid@gmail.com> wrote:
>
>> For example, we can use ${( ... )} which is now wrong syntax.
>>
>> $ v=${( command ... )}
>> bash: ${( command ... )}: bad substitution
>>
>
> Or keep it similar to $(cmd), like:
>
>   $(& cmd ...)
>   $(; cmd ...)
>   $(| cmd ...)
>

$(|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 ... }.


reply via email to

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