[ask]elimination with diskspace

dear all,

i want elimination file with disk space for example:

[itu@tux ~]$ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                       62G   19G   41G  31% /
/dev/sda1              99M   13M   82M  13% /boot
tmpfs                1014M     0 1014M   0% /dev/shm

so if used space in / 20G then will be remove file in /temp/*.txt
how can i do that with bash script

thx for your advice

Just execute the below command and check the output. If you are satisfied with output, then remove the highlighted (red color) echo from the nawk

 
deleted

Try this...

 
df-h | nawk ' $NF~/\/$/ { size=int(substr($2,length($2)-2,length($2)-1)); if( size > 20) {print "echo echo rm /tmp/*.txt"} else {print "echo echo Disk usage is under 20"}}' | sh
df -h /  | tail -n1 | 
awk '+$3 > 20 {system("echo rm")}'