ctdb-scripts: Avoid shellcheck warning SC1004 (backslash in quotes)
authorMartin Schwenke <martin@meltin.net>
Wed, 6 Jul 2016 10:09:07 +0000 (20:09 +1000)
committerAmitay Isaacs <amitay@samba.org>
Thu, 21 Jul 2016 00:24:26 +0000 (02:24 +0200)
SC1004: You don't break lines with \ in single quotes, it results in
literal backslash-linefeed.

These don't hurt, since awk can cope with the continuations.  However,
they don't add anything.

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

index cb08856db8f4deb18f39bc584d24425cf57bdd6c..9b16138da6e74772c3fa0cca9c6fa672bc5e8322 100755 (executable)
@@ -179,9 +179,9 @@ clean_up_table_ids ()
        awk -v min="$CTDB_PER_IP_ROUTING_TABLE_ID_LOW" \
            -v max="$CTDB_PER_IP_ROUTING_TABLE_ID_HIGH" \
            -v pre="$table_id_prefix" \
-           '/^#/ || \
-            !(min <= $1 && $1 <= max) && \
-            !(index($2, pre) == 1) \
+           '/^#/ ||
+            !(min <= $1 && $1 <= max) &&
+            !(index($2, pre) == 1)
             { print $0 }' "$rt_tables" >"$_tmp"
 
        mv "$_tmp" "$rt_tables"
index d3c4c59219ca0101b8a740eaaa4dbbe99d852684..3db3c8acbc0810387c42f31bb42ab16bdaf4aaec 100755 (executable)
@@ -621,11 +621,10 @@ ip_maskbits_iface ()
        *:*) _bits=128 ;;
        *)   _bits=32  ;;
     esac
-
     ip addr show to "${_addr}/${_bits}" 2>/dev/null | \
-       awk 'NR == 1 { iface = $2; sub(":$", "", iface) ; \
-                      sub("@.*", "", iface) } \
-             $1 ~ /inet/ { mask = $2; sub(".*/", "", mask); \
+       awk 'NR == 1 { iface = $2; sub(":$", "", iface) ;
+                      sub("@.*", "", iface) }
+             $1 ~ /inet/ { mask = $2; sub(".*/", "", mask);
                            print mask, iface }'
 }
 
@@ -671,7 +670,7 @@ interface_get_real ()
 
     # Extract the full interface description to see if it is a VLAN
     _t=$(echo "$_iface_info" |
-               awk 'NR == 1 { iface = $2; sub(":$", "", iface) ; \
+               awk 'NR == 1 { iface = $2; sub(":$", "", iface) ;
                               print iface }')
     case "$_t" in
        *@*)
index e40a8aa62e6457adf36ae9f4c30a75bf90e80729..74402107ffd9396029fb5120401afede6854fc99 100755 (executable)
@@ -86,8 +86,8 @@ case "$1" in
        # hosted public IP addresses.
        ctdb_ips=$($CTDB ip | tail -n +2)
        sed_expr=$(echo "$ctdb_ips" |
-           awk -v pnn="$pnn" 'pnn == $2 { \
-                ip = $1; gsub(/\./, "\\.", ip); \
+           awk -v pnn="$pnn" 'pnn == $2 {
+                ip = $1; gsub(/\./, "\\.", ip);
                 printf "/statd-state@%s@/p\n", ip }')
        # Intentional multi-word expansion for multiple files
        # shellcheck disable=SC2086
@@ -165,8 +165,8 @@ case "$1" in
        # but only for the server-IPs that are hosted on this node.
        ctdb_all_ips=$($CTDB ip all | tail -n +2)
        sed_expr=$(echo "$ctdb_all_ips" |
-           awk -v pnn="$pnn" 'pnn == $2 { \
-                ip = $1; gsub(/\./, "\\.", ip); \
+           awk -v pnn="$pnn" 'pnn == $2 {
+                ip = $1; gsub(/\./, "\\.", ip);
                 printf "s/^key.*=.*statd-state@\\(%s\\)@\\([^\"]*\\).*/\\1 \\2/p\n", ip }')
 
        statd_state=$($CTDB catdb ctdb.tdb | sed -n "$sed_expr" | sort)
index 54e416dfda72704f9699633673ef5fae9786cb77..9661cae2dead135d3e642c55f0f4442cdd288f74 100755 (executable)
@@ -107,7 +107,7 @@ EOF
     # BANNED or STOPPED)
     awk -F '|' -v ms="$_ms" \
        'BEGIN { ret = 2 }
-        ms ~ "@" $2 "@" && \
+        ms ~ "@" $2 "@" &&
             $5 == 0 && $6 == 0 && $8 == 0 { print $1, $2 ; ret=0 ; exit }
         END { exit ret }' <<EOF ||
 $nodestatus_X
@@ -116,7 +116,7 @@ EOF
     # DISCONNECTED, DISABLED or STOPPED
     awk -F '|' -v ms="$_ms" \
        'BEGIN { ret = 2 }
-        ms ~ "@" $2 "@" && \
+        ms ~ "@" $2 "@" &&
             $3 == 0 && $5 == 0 && $7 == 0 { print $1, $2 ; ret=0 ; exit }
         END { exit ret }' <<EOF ||
 $nodestatus_X
@@ -125,7 +125,7 @@ EOF
     # DISABLED
     awk -F '|' -v ms="$_ms" \
        'BEGIN { ret = 2 }
-        ms ~ "@" $2 "@" && \
+        ms ~ "@" $2 "@" &&
             $3 == 0 && $5 == 0 { print $1, $2 ; ret=0 ; exit }
         END { exit ret }' <<EOF
 $nodestatus_X