Listing 7       space.chk
:
#######################################################
# space.chk - free disk space check.
#######################################################
# If disk space %used is less than 100, then exit 0, 
# else exit 1.

# assume pwd unless directory specified on command-line.
test $# -eq 1 && dir=$1 || dir=.

/usr/bin/bdf $dir |
awk 'NR == 2 {
    x=$5
    sub(/%/, "", x)
    if ( x < 100 )
        exit 0
    exit 1
}'
exit $?


