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