xref: /freebsd/bin/pkill/tests/pgrep-_u_test.sh (revision 9f44a47fd07924afc035991af15d84e6585dea4f)
1#!/bin/sh
2# $FreeBSD$
3
4base=`basename $0`
5
6echo "1..2"
7
8name="pgrep -U <uid>"
9ruid=`id -ur`
10sleep=$(pwd)/sleep.txt
11ln -sf /bin/sleep $sleep
12$sleep 5 &
13sleep 0.3
14chpid=$!
15pid=`pgrep -f -U $ruid $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 -U <user>"
25ruid=`id -urn`
26sleep=$(pwd)/sleep.txt
27ln -sf /bin/sleep $sleep
28$sleep 5 &
29sleep 0.3
30chpid=$!
31pid=`pgrep -f -U $ruid $sleep`
32if [ "$pid" = "$chpid" ]; then
33	echo "ok 2 - $name"
34else
35	echo "not ok 2 - $name"
36fi
37kill $chpid
38rm -f $sleep
39