Skip to content

Commit

Permalink
du_multidirs: Fix up some shellcheck warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Kujau <[email protected]>
  • Loading branch information
ckujau committed Jan 7, 2024
1 parent fb6ea1c commit c702092
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions munin/plugins/du_multidirs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ if [ "$1" = "autoconf" ]; then
exit 0
fi

if [ ! -f "$CACHE" ]; then
echo "Cache $CACHE not found!"
if [ ! -f "${CACHE}" ]; then
echo "Cache ${CACHE} not found!"
exit 1
fi

Expand All @@ -29,14 +29,13 @@ if [ "$1" = "config" ]; then

# Munin doesn't like slashes, dots, hyphens and pretty much any symbols in
# its variables.
awk -F\ '!/lost\+found/ {print $2}' $CACHE | sort | while read u; do
u2=`echo "$u" | sed 's/[[:punct:]]/_/g;s/ /_/g'`
echo "$u2".label $u
# echo "$u2".warning 0
# echo "$u2".critical 0
awk -F\ '!/lost\+found/ {print $2}' "${CACHE}" | sort | while read -r u; do
u2=$(echo "${u}" | sed 's/[[:punct:]]/_/g;s/ /_/g')
echo "${u2}".label "${u}"
# echo "${u2}".warning 0
# echo "${u2}".critical 0
done
exit 0
fi

awk '!/lost\+found/ {gsub(/\//,"_"); print $2".value "$1 * 1024 }' $CACHE | sort -r -n -k2
# awk -F\ '!/lost+found/ {print $2".value "$1 * 1024 }' $CACHE | sed 's/[[:punct:]]/_/g' | sort -r -n -k2
awk '!/lost\+found/ {gsub(/\//,"_"); print $2".value "$1 * 1024 }' "${CACHE}" | sort -r -n -k2

0 comments on commit c702092

Please sign in to comment.