[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Feature Request] do comsub with builtins/functions in current env
From: |
Akbarkhon Variskhanov |
Subject: |
[Feature Request] do comsub with builtins/functions in current env |
Date: |
Sun, 9 Oct 2022 21:46:22 +0500 |
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.