xref: /freebsd/bin/pkill/tests/pgrep-x_test.sh (revision 59c8e88e72633afbc47a4ace0d2170d00d51f7dc)
1#!/bin/sh
2
3base=`basename $0`
4
5echo "1..4"
6
7name="pgrep -x"
8sleep=$(pwd)/sleep.txt
9ln -sf /bin/sleep $sleep
10$sleep 5 &
11sleep 0.3
12pid=$!
13if [ ! -z "`pgrep -x sleep | egrep '^'"$pid"'$'`" ]; then
14	echo "ok 1 - $name"
15else
16	echo "not ok 1 - $name"
17fi
18if [ -z "`pgrep -x slee | egrep '^'"$pid"'$'`" ]; then
19	echo "ok 2 - $name"
20else
21	echo "not ok 2 - $name"
22fi
23name="pgrep -x -f"
24if [ ! -z "`pgrep -x -f ''"$sleep"' 5' | egrep '^'"$pid"'$'`" ]; then
25	echo "ok 3 - $name"
26else
27	echo "not ok 3 - $name"
28fi
29if [ -z "`pgrep -x -f ''"$sleep"' ' | egrep '^'"$pid"'$'`" ]; then
30	echo "ok 4 - $name"
31else
32	echo "not ok 4 - $name"
33fi
34kill $pid
35rm -f $sleep
36