xref: /freebsd/bin/pkill/tests/pgrep-g_test.sh (revision 22cf89c938886d14f5796fc49f9f020c23ea8eaf)
1#!/bin/sh
2
3base=`basename $0`
4
5echo "1..2"
6
7name="pgrep -g <pgrp>"
8pgrp=`ps -o tpgid -p $$ | tail -1`
9sleep=$(pwd)/sleep.txt
10ln -sf /bin/sleep $sleep
11$sleep 5 &
12sleep 0.3
13chpid=$!
14pid=`pgrep -f -g $pgrp $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 0"
24sleep=$(pwd)/sleep.txt
25ln -sf /bin/sleep $sleep
26$sleep 5 &
27sleep 0.3
28chpid=$!
29pid=`pgrep -f -g 0 $sleep`
30if [ "$pid" = "$chpid" ]; then
31	echo "ok 2 - $name"
32else
33	echo "not ok 2 - $name"
34fi
35kill $chpid
36rm -f $sleep
37