Subject: bug#25353: Shell-script[bash] mode not ready for extglob

From: 積丹尼 Dan Jacobson <[email-masked]>
Date: Wed, 04 Jan 2017 17:59:52 +0800

Doing
 C-x h [mark-whole-buffer]
 <tab> [indent-for-tab-command]
just makes indentation out of whack, here where we use shopt -s extglob
patterns. emacs-version "25.1.1".

#!/bin/sh
b=256 t=10000
shopt -s extglob
while read cid
do
    echo -n "$cid: "
    case $cid in
	+([0-9])-[0-9][0-9])
			    printf "%d\n" $((${cid%-*} * 256 + ${cid#*-}))
			    for i in 01 11 21 31 41 51
			    do printf "%d %s\n" $((${cid%-*} * 256 + i)) $i
			    done
			    ;;
			    +([0-9]))
				     printf "%06d-%02d\n" $((cid / b)) $((cid % b))
				     printf "%02d-%04d-%02d\n" $((cid / b / t))  $((cid / b % t)) $((cid % b))
				     ;;
				     *) echo '???' 1>&2; exit 11;
					;;
				     esac
done