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