#!/bin/bash # User should input the threshold echo "Enter the threshold (percent):" read threshold # Check if the threshold is a number if ! [[ "$threshold" =~ ^[0-9]+$ ]]; then echo "Input is not a number, using default threshold: 20." threshold=20 else echo "Threshold = $threshold" fi df -h | awk -v threshold="$threshold" 'NR>1 {gsub(/%/,"",$5); if($5 > threshold) print "WARNING: Partition \""$1"\" used "$5"%"}'