[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Feature Request] do comsub with builtins/functions in current env
From: |
Chet Ramey |
Subject: |
Re: [Feature Request] do comsub with builtins/functions in current env |
Date: |
Mon, 10 Oct 2022 17:02:51 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.3.1 |
On 10/9/22 12:46 PM, Akbarkhon Variskhanov wrote:
I'd really like to see Bash not create a subshell for command
substitutions involving built-ins and functions.
This has come up before, and the consensus to this point is that the
ksh93 syntax is worth adopting. I haven't looked closely at implementing
it yet.
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
That's not how it works. The fork, yes, but the forked child just runs the
command.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/