]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-scripts: Avoid shellcheck warning SC2004 ($ in arithmetic)
authorMartin Schwenke <martin@meltin.net>
Wed, 6 Jul 2016 06:50:30 +0000 (16:50 +1000)
committerAmitay Isaacs <amitay@samba.org>
Thu, 21 Jul 2016 00:24:26 +0000 (02:24 +0200)
SC2004: $/${} is unnecessary on arithmetic variables.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/config/ctdbd_wrapper
ctdb/config/events.d/13.per_ip_routing
ctdb/config/events.d/20.multipathd
ctdb/config/events.d/60.nfs
ctdb/config/functions
ctdb/config/statd-callout

index caeb81a9e748e5c2076eed43e75a2082f51e00b1..29b015437a11b84c9161ba64057628eb9083765e 100755 (executable)
@@ -263,7 +263,7 @@ start()
            fi
        fi
 
-       _count=$(($_count + 1))
+       _count=$((_count + 1))
        sleep 1
     done
 
@@ -292,7 +292,7 @@ stop()
            break
        fi
 
-       _count=$(($_count + 1))
+       _count=$((_count + 1))
        sleep 1
     done
 
index bee8e2cc4809b23a3a472a5b066649517589ac57..7dbf15818ab3caa6d3e83de1233a27f2e4b55c24 100755 (executable)
@@ -48,7 +48,7 @@ ipv4_is_valid_addr()
        if ! [ 0 -le $_o -a $_o -le 255 ] 2>/dev/null ; then
            return 1
        fi
-       _count=$(($_count + 1))
+       _count=$((_count + 1))
     done
 
     # A valid IPv4 address has 4 octets
@@ -75,18 +75,18 @@ ipv4_host_addr_to_net ()
     # the octets and doing the math.
     _host_ul=0
     for _o in $(export IFS="." ; echo $_host) ; do
-       _host_ul=$(( ($_host_ul << 8) + $_o)) # work around Emacs color bug
+       _host_ul=$(( (_host_ul << 8) + _o)) # work around Emacs color bug
     done
 
     # Calculate the mask and apply it.
-    _mask_ul=$(( 0xffffffff << (32 - $_maskbits) ))
-    _net_ul=$(( $_host_ul & $_mask_ul ))
+    _mask_ul=$(( 0xffffffff << (32 - _maskbits) ))
+    _net_ul=$(( _host_ul & _mask_ul ))
  
     # Now convert to a network address one byte at a time.
     _net=""
     for _o in $(seq 1 4) ; do
-       _net="$(($_net_ul & 255))${_net:+.}${_net}"
-       _net_ul=$(($_net_ul >> 8))
+       _net="$((_net_ul & 255))${_net:+.}${_net}"
+       _net_ul=$((_net_ul >> 8))
     done
 
     echo "${_net}/${_maskbits}"
@@ -142,7 +142,7 @@ ensure_table_id_for_ip ()
            # redirect stops error spam for a non-numeric value.
            if [ $_new -le $_t -a \
                $_t -le $CTDB_PER_IP_ROUTING_TABLE_ID_HIGH ] 2>/dev/null ; then
-               _new=$(($_t + 1))
+               _new=$((_t + 1))
            fi
        done
 
index 92561589029f728368387a9438ae304f7cd85ec4..0fe140f839daf547a2cdcd5e32fa5db3cb130373 100755 (executable)
@@ -49,7 +49,7 @@ multipathd_check()
     _timeleft=10
 
     while [ $_timeleft -gt 0 ]; do
-       _timeleft=$(($_timeleft - 1))
+       _timeleft=$((_timeleft - 1))
 
        # see if the process still exists
        kill -0 $_pid >/dev/null 2>&1 || {
index 189e2f6203f2e6131894ab81aa148541c532bc5b..15def341873af3a7c61588c629c3b3605ecfbb7f 100755 (executable)
@@ -153,7 +153,7 @@ nfs_check_service ()
        fi
 
        if [ $restart_every -gt 0 ] ; then
-           if [ $(($_failcount % $restart_every)) -eq 0 ] ; then
+           if [ $((_failcount % restart_every)) -eq 0 ] ; then
                if ! $_unhealthy ; then
                    echo "WARNING: $_err"
                fi
index 251779d8949c3102a0ef6190953325761b006982..bc7abcc2e1223469a3b0b8ed92e2e2032f31940c 100755 (executable)
@@ -306,7 +306,7 @@ program_stack_traces ()
        if [ -n "$_stack" ] ; then
            echo "Stack trace for ${_prog}[${_pid}]:"
            echo "$_stack"
-           _count=$(($_count + 1))
+           _count=$((_count + 1))
        fi
     done
 }
@@ -475,7 +475,7 @@ kill_tcp_connections ()
                _connections="${_connections}${_nl}${_dst} ${_src}"
            fi
 
-           _killcount=$(($_killcount + 1))
+           _killcount=$((_killcount + 1))
        done
 
        if [ $_killcount -eq 0 ] ; then
index 509ed182c06bc452b7eadb2f3cf53f32b9ca62fb..af3af9d1a7c697136b5cec6b2968c8a740748c09 100755 (executable)
@@ -192,7 +192,7 @@ case "$1" in
                "$smnotify" --client="$cip" --ip="$sip" \
                            --server="$NFS_HOSTNAME" --stateval="$stateval"
                # Send notifies for server startup
-               stateval=$(($stateval + 1))
+               stateval=$((stateval + 1))
                "$smnotify" --client="$cip" --ip="$sip" \
                            --server="$sip" --stateval="$stateval"
                "$smnotify" --client="$cip" --ip="$sip" \