Fixed share/disk size calculation when names include space

This commit is contained in:
bergware
2019-01-15 21:42:51 +01:00
parent 26632428f7
commit d1bd682aa0
2 changed files with 4 additions and 6 deletions
+2 -3
View File
@@ -22,9 +22,8 @@ function check {
total=$(($total + $size))
fi
}
shares=$(ls -vd /mnt/user/*)
for share in $shares; do
while IFS=$'\n' read -r share; do
[[ -d $share ]] && check "$(basename "$share")" "$disk"
done
done <<< $(ls -vd /mnt/user/*)
echo "share.total=$total" >>"$output"
echo "total disk usage: $total"
+2 -3
View File
@@ -23,9 +23,8 @@ function check {
}
check "/mnt/cache" "$share"
disks=$(ls -vd /mnt/disk*)
for disk in $disks ; do
while IFS=$'\n' read -r disk; do
check "$disk" "$share"
done
done <<< $(ls -vd /mnt/disk[0-9]*)
echo "disk.total=$total" >>"$output"
echo "total disk usage: $total"