#!/bin/bash # diskspace--Summarizes available disk space and presents it in a logical # and readable fashion. tempfile="/tmp/available.$$" trap "rm -f $tempfile" EXIT cat << 'EOF' > $tempfile { sum += $4 } END { mb = sum / 1024 gb = mb / 1024 printf "%.0f MB (%.2fGB) of available disk space\n", mb, gb } EOF df -k | awk -f $tempfile exit 0