#!/bin/sh rm -f fallocate /tmp/afile /tmp/bfile gcc fallocate.c -o fallocate if [ ! -x fallocate ] ; then echo Test program did not compile, posix_fallocate may not be supported exit fi ./fallocate if [ -f /tmp/afile ] ; then sizea=`du /tmp/afile | cut -f 1` sizeb=`du /tmp/bfile | cut -f 1` if [ "$sizea" -eq "$sizeb" ] ; then cmp /tmp/afile /tmp/bfile if [ "$?" -ne 0 ] ; then echo Test failed, files do not match else echo Test passed fi else echo Test failed, sizes do not match fi fi