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