From: Martin Schwenke Date: Wed, 6 Jul 2016 06:50:30 +0000 (+1000) Subject: ctdb-scripts: Avoid shellcheck warning SC2004 ($ in arithmetic) X-Git-Tag: tdb-1.3.10~273 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=13b3c6af64fb0ac91b47254518287b804ecbef48;p=thirdparty%2Fsamba.git ctdb-scripts: Avoid shellcheck warning SC2004 ($ in arithmetic) SC2004: $/${} is unnecessary on arithmetic variables. Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/config/ctdbd_wrapper b/ctdb/config/ctdbd_wrapper index caeb81a9e74..29b015437a1 100755 --- a/ctdb/config/ctdbd_wrapper +++ b/ctdb/config/ctdbd_wrapper @@ -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 diff --git a/ctdb/config/events.d/13.per_ip_routing b/ctdb/config/events.d/13.per_ip_routing index bee8e2cc480..7dbf15818ab 100755 --- a/ctdb/config/events.d/13.per_ip_routing +++ b/ctdb/config/events.d/13.per_ip_routing @@ -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 diff --git a/ctdb/config/events.d/20.multipathd b/ctdb/config/events.d/20.multipathd index 92561589029..0fe140f839d 100755 --- a/ctdb/config/events.d/20.multipathd +++ b/ctdb/config/events.d/20.multipathd @@ -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 || { diff --git a/ctdb/config/events.d/60.nfs b/ctdb/config/events.d/60.nfs index 189e2f6203f..15def341873 100755 --- a/ctdb/config/events.d/60.nfs +++ b/ctdb/config/events.d/60.nfs @@ -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 diff --git a/ctdb/config/functions b/ctdb/config/functions index 251779d8949..bc7abcc2e12 100755 --- a/ctdb/config/functions +++ b/ctdb/config/functions @@ -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 diff --git a/ctdb/config/statd-callout b/ctdb/config/statd-callout index 509ed182c06..af3af9d1a7c 100755 --- a/ctdb/config/statd-callout +++ b/ctdb/config/statd-callout @@ -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" \