xref: /freebsd/bin/pkill/tests/pgrep-n_test.sh (revision fe75646a0234a261c0013bf1840fdac4acaf0cec)
1#!/bin/sh
2
3base=`basename $0`
4
5echo "1..1"
6
7name="pgrep -n"
8sleep=$(pwd)/sleep.txt
9ln -sf /bin/sleep $sleep
10$sleep 5 &
11oldpid=$!
12$sleep 5 &
13sleep 0.3
14newpid=$!
15pid=`pgrep -f -n $sleep`
16if [ "$pid" = "$newpid" ]; then
17	echo "ok - $name"
18else
19	echo "not ok - $name"
20fi
21kill $oldpid
22kill $newpid
23rm -f $sleep
24