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: Sun, 10 May 2020 17:43:17 -0500

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

On 5/10/20, Eli Schwartz <address@hidden> wrote:
> On 5/10/20 5:53 PM, Peng Yu wrote:
>>> Have you tried this:
>>>
>>> $ cat ./main2.sh
>>> #!/usr/bin/env bash
>>> # vim: set noexpandtab tabstop=2:
>>>
>>> set -v
>>> echo "$BASHPID"
>>> function f {
>>>     echo "$BASHPID"
>>> }
>>> f
>>> $
>>
>> The output of f must be saved in a bash variable.
>
>
> You've carefully avoided quoting the rest of my email, in which I
> explained how to do this.
>
> --
> Eli Schwartz
> Arch Linux Bug Wrangler and Trusted User
>
>


-- 
Regards,
Peng



reply via email to

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