fix quota

This commit is contained in:
2021-12-18 13:02:49 +01:00
parent 81fc921e3f
commit 868d131972
3 changed files with 14 additions and 5 deletions

View File

@@ -347,8 +347,8 @@ if [ "$ACTION" == "quota" ]; then
echo "Calculating account disk usage..."
echo
USAGE=$(quota -gsl | tail -n 1 | awk -F" " '{ print $2 }' | sed 's/[A-Za-z]//g')
QUOTA=$(quota -gsl | tail -n 1 | awk -F" " '{ print $3 }' | sed 's/[A-Za-z]//g')
USAGE=$(cat quota | tail -n 1 | awk -F" " '{ print $2 }')
QUOTA=$(cat quota | tail -n 1 | awk -F" " '{ print $3 }' | sed 's/[A-Za-z]//g')
# If smaller than 1M, set usage to 1M to avoid miscalcuations
if ! echo $USAGE | grep -q "[A-Za-z]$"; then
@@ -364,7 +364,7 @@ if [ "$ACTION" == "quota" ]; then
PERC=$(echo "scale=2; 100 - $PERC" | bc)
echo "You have "$[$QUOTA - $USAGE]" MB free ($PERC %)."
echo "You have "$(($QUOTA - $USAGE))" MB free ($PERC %)."
fi # /quota