print disk space warning of 70%

Hi All,

I have a script that run every night to check disk space.

echo "Warning: Disk with 70%~79% used" && df -k | grep [7].%

I want the echo should go out only if there's a FS usage findings of 70%+. I want a simple shell script, not with if and then script.

Thank you for any comments you may add.

try

df -k | grep '%' | awk '($1>69)?$0="FOUND":$0=""' |grep -q 'FOUND' && echo "disk 70% and greater"

This finds anything > 69%: 70 - 100.

1 Like