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