Skip to content

Commit e40adf8

Browse files
committed
Fix syntax errors in disk_checker.sh for proper execution
1 parent 76b7f72 commit e40adf8

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

projects/02_disk_space_checker/bash/disk_checker.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,20 @@ while read -r LINE; do
2121
MOUNT=$(echo "$LINE" | awk '{print $6}')
2222

2323
# Conditional: check if usage exceeds threshold
24-
if [ "$USAGE" -ge "$THRESHOLD" \; then
24+
if [ "$USAGE" -ge "$THRESHOLD" ]; then
2525
echo "⚠️ ALERT: $FILESYSTEM mounted on $MOUNT is at ${USAGE}% (threshold: ${THRESHOLD}%)"
2626
echo "$DATE | ALERT | $FILESYSTEM ($MOUNT) at ${USAGE}%" >> "$ALERT_LOG"
27-
ALERT_COUNT$((ALERT_COUNT + 1))
27+
ALERT_COUNT=$((ALERT_COUNT + 1))
2828
else
2929
echo "$FILESYSTEM mounted on $MOUNT is at ${USAGE}%"
3030
fi
3131
done < <(df -H -x tmpfs -x devtmpfs | tail -n +2)
3232

3333
# ------------ Summary -----------------------------
3434
echo "---------------------------------------"
35-
if ["$ALERT_COUNT" -gt 0 ]; then
35+
if [ "$ALERT_COUNT" -gt 0 ]; then
3636
echo "⚠️ $ALERT_COUNT filesystem(s) over ${THRESHOLD}% threshold!"
37-
echo" Alerts logged to: $ALERT_LOG"
37+
echo " Alerts logged to: $ALERT_LOG"
3838
else
3939
echo "✅ All filesystems are within the ${THRESHOLD}% threshold."
4040
fi

0 commit comments

Comments
 (0)