#!/bin/sh
#zero: empty the contents of a file

if [ $# = 0 ] ;then
	echo "usage: zero <files...>"
	echo "       truncates files to length zero"
	exit 10
fi

# if [ -r $* ] ;then
	while [ $# != 0 ] ;do
		if [ -w $1 ] ;then
# 			ls -ailsF $1
# 			mv $1 $1.$$
			touch -r $1 $1.$$
			cat </dev/null > $1
			touch -r $1.$$ $1
			rm -f $1.$$
		else
			echo "$0: $1: permission denied/not writeable"
		fi
		shift 1
	done
# else
# 	echo "$0: $*: not found/readable"
# fi
