From: "積丹尼 Dan Jacobson" <jidanni@jidanni.org>
To: 25353@debbugs.gnu.org
Subject: bug#25353: Shell-script[bash] mode not ready for extglob
Date: Wed, 04 Jan 2017 17:59:52 +0800 [thread overview]
Message-ID: <87a8b7b0x3.fsf@jidanni.org> (raw)
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
reply other threads:[~2017-01-04 9:59 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87a8b7b0x3.fsf@jidanni.org \
--to=jidanni@jidanni.org \
--cc=25353@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.