From: Martin Schwenke Date: Wed, 6 Jul 2016 10:17:26 +0000 (+1000) Subject: ctdb-scripts: Avoid shellcheck warning SC2002 (useless cat) X-Git-Tag: tdb-1.3.10~267 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=77341f61baa2e90a8935fd16a0775be8eb9005c9;p=thirdparty%2Fsamba.git ctdb-scripts: Avoid shellcheck warning SC2002 (useless cat) SC2002: Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead. Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/config/debug_locks.sh b/ctdb/config/debug_locks.sh index 9726247a6ae..5d4400443d9 100755 --- a/ctdb/config/debug_locks.sh +++ b/ctdb/config/debug_locks.sh @@ -32,8 +32,7 @@ loadconfig ctdb # Parse /proc/locks and extract following information # pid process_name tdb_name offsets [W] - out=$( cat /proc/locks | - grep -F "POSIX ADVISORY WRITE" | + out=$( grep -F "POSIX ADVISORY WRITE" /proc/locks | awk '{ if($2 == "->") { print $6, $7, $8, $9, "W" } else { print $5, $6, $7, $8 } }' | while read pid rest ; do pname=$(readlink "/proc/${pid}/exe") diff --git a/ctdb/config/statd-callout b/ctdb/config/statd-callout index ce7d63997d3..4ac354ef29b 100755 --- a/ctdb/config/statd-callout +++ b/ctdb/config/statd-callout @@ -91,7 +91,7 @@ case "$1" in printf "/statd-state@%s@/p\n", ip }') # Intentional multi-word expansion for multiple files # shellcheck disable=SC2086 - if cat $files | sed -n "$sed_expr" | $CTDB ptrans "ctdb.tdb" ; then + if sed -n "$sed_expr" $files | $CTDB ptrans "ctdb.tdb" ; then rm $files fi ;; diff --git a/ctdb/tools/ctdb_diagnostics b/ctdb/tools/ctdb_diagnostics index 6b33c7ce537..139b406a5a8 100755 --- a/ctdb/tools/ctdb_diagnostics +++ b/ctdb/tools/ctdb_diagnostics @@ -106,7 +106,7 @@ show_file() { echo " ================================" echo " File: $fname" echo " $_fdetails" - cat "$fname" 2>&1 | sed 's/^/ /' + sed 's/^/ /' "$fname" 2>&1 echo " ================================" } @@ -138,7 +138,7 @@ show_and_compare_files () { echo " ================================" echo " File (on node $n): $f" echo " `onnode $n ls -l $f 2>&1`" - cat "$fstf" | sed 's/^/ /' + sed 's/^/ /' "$fstf" echo " ================================" first=false else