]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - bin/pkill/tests/pgrep-_f_test.sh
zfs: merge openzfs/zfs@688514e47
[FreeBSD/FreeBSD.git] / bin / pkill / tests / pgrep-_f_test.sh
1 #!/bin/sh
2
3 base=`basename $0`
4
5 echo "1..1"
6
7 name="pgrep -F <pidfile>"
8 pidfile=$(pwd)/pidfile.txt
9 sleep=$(pwd)/sleep.txt
10 ln -sf /bin/sleep $sleep
11 $sleep 5 &
12 sleep 0.3
13 chpid=$!
14 echo $chpid > $pidfile
15 pid=`pgrep -f -F $pidfile $sleep`
16 if [ "$pid" = "$chpid" ]; then
17         echo "ok - $name"
18 else
19         echo "not ok - $name"
20 fi
21 kill "$chpid"
22 rm -f $pidfile
23 rm -f $sleep