help-bash
[Top][All Lists]
Advanced

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

Re: Is there a way to get the output of a function without an extra bash


From: Peng Yu
Subject: Re: Is there a way to get the output of a function without an extra bash process?
Date: Mon, 11 May 2020 16:22:28 -0500

On 5/11/20, Chet Ramey <address@hidden> wrote:
> On 5/10/20 6:43 PM, Peng Yu wrote:
>> Hi Chet, Could a new feature be added to bash so that no exec is
>> needed in the case of $(cmd). Maybe introducing a new syntax like $(:
>> cmd)?
>
> I assume you mean no fork. I've thought about this a little, but there is
> a lot of state that would have to be saved and restored to preserve the
> subshell environment semantics of command substitution. I haven't done
> anything to implement that.

According to Eli Schwartz, ksh supports `var=${ listcmd; }`. Sine ksh
can do it, this features should be doable in bash? Or bash and ksh are
fundamentally different so that it is much more difficult to implement
this in bash? Or maybe you can implement first for some restricted
cases to make the change manageable then gradually add code for the
more complicated cases to make this feature complete? Thanks.

-- 
Regards,
Peng



reply via email to

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