From: Martin Schwenke Date: Wed, 6 Jul 2016 10:09:07 +0000 (+1000) Subject: ctdb-scripts: Avoid shellcheck warning SC1004 (backslash in quotes) X-Git-Tag: tdb-1.3.10~269 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0ca00267cd2620a14968961738bcd2a69b597e95;p=thirdparty%2Fsamba.git ctdb-scripts: Avoid shellcheck warning SC1004 (backslash in quotes) 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 Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/config/events.d/13.per_ip_routing b/ctdb/config/events.d/13.per_ip_routing index cb08856db8f..9b16138da6e 100755 --- a/ctdb/config/events.d/13.per_ip_routing +++ b/ctdb/config/events.d/13.per_ip_routing @@ -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" diff --git a/ctdb/config/functions b/ctdb/config/functions index d3c4c59219c..3db3c8acbc0 100755 --- a/ctdb/config/functions +++ b/ctdb/config/functions @@ -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 *@*) diff --git a/ctdb/config/statd-callout b/ctdb/config/statd-callout index e40a8aa62e6..74402107ffd 100755 --- a/ctdb/config/statd-callout +++ b/ctdb/config/statd-callout @@ -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) diff --git a/ctdb/tools/ctdb_natgw b/ctdb/tools/ctdb_natgw index 54e416dfda7..9661cae2dea 100755 --- a/ctdb/tools/ctdb_natgw +++ b/ctdb/tools/ctdb_natgw @@ -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 }' <