Re: local - im functions , applies to set like -f too ?
From:
Lawrence Velázquez
Subject:
Re: local - im functions , applies to set like -f too ?
Date:
Tue, 05 Nov 2024 16:26:13 -0500
On Tue, Nov 5, 2024, at 1:53 PM, #!microsuxx wrote:
> .. or does it restore only the shopts ? not set opts
Other way around. It restores "set" options but not "shopt" options.
$ cat /tmp/testlocal.bash
printopts() {
set -o | grep noglob
shopt extglob
}
testlocal() {
local -
set -f
shopt -s extglob
printopts
}
echo beginning; printopts
echo
echo middle; testlocal
echo
echo end; printopts
$ ./bash /tmp/testlocal.bash
beginning
noglob off
extglob off
middle
noglob on
extglob on
end
noglob off
extglob on
This is documented in the description of "local" and would have
been trivial for you to test yourself.
--
vq