Greetings,
After upgrading to bash-5.3, I ran into a strange problem with many of my
scripts: It looks like in bash-5.3, setting the extglob option can crash my
script, if the shopt command is inside an if-then-fi structure, or if it's
inside a for-do-done loop. For example, here is a snippet that works fine in
bash-5.2, but breaks in bash-5.3:
#---------------------------------------
shopt -u extglob
# [...]
if true; then
shopt -s extglob
echo /!(tmp.txt)
fi
#---------------------------------------
...and it bombs really bad, it aborts the whole script.
Simillarly, this one breaks too:
#---------------------------------------
shopt -u extglob
# [...]
for i in 1 2; do
shopt -s extglob
echo /!(something)
done
#---------------------------------------
And even this one breaks in bash-5.3:
#---------------------------------------
shopt -u extglob
# [...]
shopt -s extglob; echo !(something)
#---------------------------------------
Interestingly, if I modify the if-then-fi structure this way...
#---------------------------------------
shopt -s extglob
if true; then
echo /!(tmp.txt)
fi
#---------------------------------------
...then it does not break. But then, this is not really a solution to the
problem.
Yours,
Pourko
--
Secured with Tuta Mail:
https://tuta.com/free-email