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