1#!/bin/sh 2 3base=`basename $0` 4 5echo "1..1" 6 7name="pgrep -F <pidfile>" 8pidfile=$(pwd)/pidfile.txt 9sleep=$(pwd)/sleep.txt 10ln -sf /bin/sleep $sleep 11$sleep 5 & 12sleep 0.3 13chpid=$! 14echo $chpid > $pidfile 15pid=`pgrep -f -F $pidfile $sleep` 16if [ "$pid" = "$chpid" ]; then 17 echo "ok - $name" 18else 19 echo "not ok - $name" 20fi 21kill "$chpid" 22rm -f $pidfile 23rm -f $sleep 24