On Wed, 27 Aug 2025 at 15:16, Koichi Murase <myoga.mur...@gmail.com> wrote:
> > However, this isn't true. With these features implemented as shell > options, in general, one actually needs to write it in the following > way: > > local saved=$(shopt -p cmdsubst_trailing_nls) # (assume we are in a > function) > shopt -s cmdsubst_trailing_nls > foo=$(some_command ...) > eval -- "$saved" Couldn't we just dictate that "local -" saves all set -o and shopt settings (or at least all new ones going forward)? So then it'd be just: fn() { local - shopt -s cmdsubst_trailing_nls foo=$( some_command … ) } Or maybe it's time to consider: fn() { local -O cmdsubst_trailing_nls=1 foo=$( some_command … ) } -Martin