Here is a example...
tmp=/tmp/"$LOGNAME".usg user=$LOGNAME if [ ! "$1" = "" ]; then user=$1 fi for file in `ls` do fuser -u $file >>$tmp 2>$tmp # cat $tmp fi=`grep $user $tmp | wc -l` fi=`echo $fi` if [ ! "$fi" = "0" ]; then echo ok - $file fi done rm $tmp