As we all know UNIX is very good for nice, common tasks like shooting yourself in your foot.

% ls
foot.c foot.h foot.o toe.c toe.h toe.o
% rm * .o
rm: .o: No such file or directory
% ls
%

This is a slightly more elaborate tool which does something very similar (credits Peter da Silva):

echo=:
daddy=$$
while true; do
du -s * | sort -n | (
total=0
while read blocks victim; do
total=`expr $total + $blocks`
done
case $total in
0) echo "No more crap on the disk!"; kill $daddy; exit;;
1) s="";;
*) s=s;;
esac
$echo "$total block$s of crap on the disk."
$echo ""
echo "$total block$s of crap on the disk,"
echo "$total block$s of crap,"
echo "Take $blocks down and feed them to /dev/null"
rm -rf $victim
)
echo=echo
done
[ published on Sun 11.01.2004 22:57 | filed in interests/comp | ]
Debian Silver Server
© Alexander Zangerl