all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#25353: Shell-script[bash] mode not ready for extglob
@ 2017-01-04  9:59 積丹尼 Dan Jacobson
  0 siblings, 0 replies; only message in thread
From: 積丹尼 Dan Jacobson @ 2017-01-04  9:59 UTC (permalink / raw
  To: 25353

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





^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-01-04  9:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-04  9:59 bug#25353: Shell-script[bash] mode not ready for extglob 積丹尼 Dan Jacobson

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.