xref: /freebsd/bin/pkill/tests/pgrep-n_test.sh (revision e1c4c8dd8d2d10b6104f06856a77bd5b4813a801)
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