[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Feature Request] do comsub with builtins/functions in current env
From: |
Tony Esposito |
Subject: |
Re: [Feature Request] do comsub with builtins/functions in current env |
Date: |
Sun, 9 Oct 2022 12:21:51 -0500 |
To build on this request, can we make it optional? Can we add the feature
to bash and disable it with a command-line flag or environment setting?
On Sun, Oct 9, 2022 at 11:46 AM Akbarkhon Variskhanov <
akbarkhon.variskhanov@gmail.com> wrote:
> I'd really like to see Bash not create a subshell for command
> substitutions involving built-ins and functions.
>
> Consider this situation:
> > maxfd=$(ulimit -n)
> or this:
> > default_umask=$(umask)
> Bash forks a new process just for those two. That doesn't really make
> sense to me. Create another process, exec() another instance of bash
> in it just to execute a built-in that was already known to the parent
> bash anyway?
> I believe ksh93 and mksh do this kind of "smart" branching, with the
> latter also having the var=${ cmd; } form.
>
> What do you think about incorporating such a feature into Bash?
>
> Cheers,
> Akbar.
>
>