bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

A BUG in bash-5.3 and extglob


From: pourko
Subject: A BUG in bash-5.3 and extglob
Date: Sat, 30 Aug 2025 15:07:10 +0200 (CEST)

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]