tDon't leave base16 conversion to dc(1) - monochromatic - monochromatic blog: http://blog.z3bra.org
(HTM) git clone git://z3bra.org/monochromatic
(DIR) Log
(DIR) Files
(DIR) Refs
---
(DIR) commit ebaaf6486bfb170ac14f0634e3ee38f0a065aa9d
(DIR) parent 251e9d348d825c5b45f0ecef5d19692bdc25ef01
(HTM) Author: z3bra <willyatmailoodotorg>
Date: Fri, 16 Sep 2016 00:58:20 +0200
Don't leave base16 conversion to dc(1)
Diffstat:
M publi.sh | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
---
(DIR) diff --git a/publi.sh b/publi.sh
t@@ -5,8 +5,9 @@ link=$(ls -l last.txt | sed 's^.*-> /;s.txt$.html')
test -z "$EDITOR" && EDITOR=vi
# get last number used (in hexa) and increment it
-last=$(<index.txt cut -d' ' -f2 | sed 's/0x0*//;1q')
-next=$(printf "0x%04x" `echo "1 16i${last}+p"|dc`)
+hexa=$(<index.txt cut -d' ' -f2 | sed 's/0x0*//;1q')
+last=$(printf '%d' "0x${hexa}")
+next=$(printf "0x%04x" `echo "1 ${last}+p"|dc`)
# format our title and put it in a temp file
title=$(sed '1s/^# /* '$next' - /;1p;d' < last.txt)