1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-10 01:18:15 +03:00

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 <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
Martin Schwenke 2016-07-06 20:09:07 +10:00 committed by Amitay Isaacs
parent b208ae73d1
commit 0ca00267cd
4 changed files with 14 additions and 15 deletions

View File

@ -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"

View File

@ -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
*@*)

View File

@ -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)

View File

@ -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