xref: /freebsd/bin/pkill/tests/pgrep-q_test.sh (revision 6574b8ed19b093f0af09501d2c9676c28993cb97)
1#!/bin/sh
2# $FreeBSD$
3
4base=`basename $0`
5
6echo "1..4"
7
8name="pgrep -q"
9sleep0=$(pwd)/sleep0.txt
10sleep1=$(pwd)/sleep1.txt
11ln -sf /bin/sleep $sleep0
12$sleep0 5 &
13sleep 0.3
14pid=$!
15out="`pgrep -q -f $sleep0 2>&1`"
16if [ $? -eq 0 ]; then
17	echo "ok 1 - $name"
18else
19	echo "not ok 1 - $name"
20fi
21if [ -z "${out}" ]; then
22	echo "ok 2 - $name"
23else
24	echo "not ok 2 - $name"
25fi
26out="`pgrep -q -f $sleep1 2>&1`"
27if [ $? -ne 0 ]; then
28	echo "ok 3 - $name"
29else
30	echo "not ok 3 - $name"
31fi
32if [ -z "${out}" ]; then
33	echo "ok 4 - $name"
34else
35	echo "not ok 4 - $name"
36fi
37kill $pid
38rm -f $sleep0 $sleep1
39