#!/bin/sh # diskspace - summarize available disk space and present 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