Skip to content

Commit

Permalink
ctdb-scripts: Avoid shellcheck warning SC2002 (useless cat)
Browse files Browse the repository at this point in the history
SC2002: Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.

Signed-off-by: Martin Schwenke <[email protected]>
Reviewed-by: Amitay Isaacs <[email protected]>
  • Loading branch information
martin-schwenke authored and Amitay Isaacs committed Jul 21, 2016
1 parent fc858a1 commit 77341f6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions ctdb/config/debug_locks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion ctdb/config/statd-callout
Original file line number Diff line number Diff line change
Expand Up @@ -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
;;
Expand Down
4 changes: 2 additions & 2 deletions ctdb/tools/ctdb_diagnostics
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ show_file() {
echo " ================================"
echo " File: $fname"
echo " $_fdetails"
cat "$fname" 2>&1 | sed 's/^/ /'
sed 's/^/ /' "$fname" 2>&1
echo " ================================"
}

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 77341f6

Please sign in to comment.