xref: /freebsd/bin/pkill/tests/pgrep-_g_test.sh (revision 734e82fe33aa764367791a7d603b383996c6b40b)
1#!/bin/sh
2
3base=`basename $0`
4
5echo "1..2"
6
7name="pgrep -G <gid>"
8rgid=`id -gr`
9sleep=$(pwd)/sleep.txt
10ln -sf /bin/sleep $sleep
11$sleep 5 &
12sleep 0.3
13chpid=$!
14pid=`pgrep -f -G $rgid $sleep`
15if [ "$pid" = "$chpid" ]; then
16	echo "ok 1 - $name"
17else
18	echo "not ok 1 - $name"
19fi
20kill $chpid
21rm -f $sleep
22
23name="pgrep -G <group>"
24rgid=`id -grn`
25sleep=$(pwd)/sleep.txt
26ln -sf /bin/sleep $sleep
27$sleep 5 &
28sleep 0.3
29chpid=$!
30pid=`pgrep -f -G $rgid $sleep`
31if [ "$pid" = "$chpid" ]; then
32	echo "ok 2 - $name"
33else
34	echo "not ok 2 - $name"
35fi
36kill $chpid
37rm -f $sleep
38