chiark / gitweb /
hush.in: Dereference variables explicitly inside $((...)).
authorMark Wooding <mdw@distorted.org.uk>
Tue, 15 Dec 2015 19:15:23 +0000 (19:15 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Fri, 29 Jan 2016 10:07:54 +0000 (10:07 +0000)
These were somehow missed by f9f9787a...

hush.in

diff --git a/hush.in b/hush.in
index f10f5070ab50eb8689052aa8be4aaa7ac6d3a8d3..114e6b0221ebc40effc76e74f2efe892f6f1e780 100755 (executable)
--- a/hush.in
+++ b/hush.in
@@ -75,7 +75,7 @@ EOF
     *) echo >&2 "$usage"; exit 1 ;;
   esac
 done
-shift $(( OPTIND - 1 ))
+shift $(( $OPTIND - 1 ))
 
 ## Check the arguments.
 case $# in 0 | 1) echo >&2 "$usage"; exit 1 ;; esac
@@ -103,7 +103,7 @@ date=$(date +%Y-%m-%d) seq=1
 for i in "$logdir/$tag.$date#"*; do
   tail=${i##*#}
   case "$tail" in [!1-9]* | *[!0-9]*) continue ;; esac
-  if [ -f "$i" -a $tail -ge $seq ]; then seq=$(( tail + 1 )); fi
+  if [ -f "$i" -a $tail -ge $seq ]; then seq=$(( $tail + 1 )); fi
 done
 log="$logdir/$tag.$date#$seq"
 
@@ -112,7 +112,7 @@ log="$logdir/$tag.$date#$seq"
 ## example) end up giving the wrong group write permission to the file for a
 ## little bit.
 umask=$(umask)
-case ${mode+t} in t) ;; *) mode=$(printf %o $(( 0666 & ~umask ))) ;; esac
+case ${mode+t} in t) ;; *) mode=$(printf %o $(( 0666 & ~$umask ))) ;; esac
 umask 077; exec 3>"$log"; umask $umask
 case ${owner+t} in t) chown "$owner" "$log" ;; esac
 chmod $mode "$log"