diff --git a/autotools/build-bash-completion b/autotools/build-bash-completion
index 359f7a85e0b0501c4000061e81c11f16f5b57d62..8687254e03cdd6ce3f1cc262b99cca093840d217 100755
--- a/autotools/build-bash-completion
+++ b/autotools/build-bash-completion
@@ -639,6 +639,11 @@ def main():
   buf = StringIO()
   sw = utils.ShellWriter(buf, indent=not options.compact)
 
+  # Remember original state of extglob and enable it (required for pattern
+  # matching; must be enabled while parsing script)
+  sw.Write("gnt_shopt_extglob=$(shopt -p extglob || :)")
+  sw.Write("shopt -s extglob")
+
   WritePreamble(sw, not options.compact)
 
   # gnt-* scripts
@@ -656,6 +661,10 @@ def main():
                   not options.compact,
                   opts=burnin.OPTIONS, args=burnin.ARGUMENTS)
 
+  # Reset extglob to original value
+  sw.Write("[[ -n \"$gnt_shopt_extglob\" ]] && $gnt_shopt_extglob")
+  sw.Write("unset gnt_shopt_extglob")
+
   print buf.getvalue()