xref: /freebsd/bin/pkill/tests/pkill-x_test.sh (revision 193d9e768ba63fcfb187cfd17f461f7d41345048)
1#!/bin/sh
2# $FreeBSD$
3
4base=`basename $0`
5
6echo "1..4"
7
8name="pkill -x"
9sleep=$(pwd)/sleep.txt
10ln -sf /bin/sleep $sleep
11$sleep 5 &
12sleep 0.3
13pkill -x slee -P $$
14if [ $? -ne 0 ]; then
15	echo "ok 1 - $name"
16else
17	echo "not ok 1 - $name"
18fi
19pkill -x sleep -P $$
20if [ $? -eq 0 ]; then
21	echo "ok 2 - $name"
22else
23	echo "not ok 2 - $name"
24fi
25rm -f $sleep
26
27name="pkill -x -f"
28sleep=$(pwd)/sleep.txt
29ln -sf /bin/sleep $sleep
30$sleep 5 &
31sleep 0.3
32pkill -x -f "$sleep " -P $$
33if [ $? -ne 0 ]; then
34	echo "ok 3 - $name"
35else
36	echo "not ok 3 - $name"
37fi
38pkill -x -f "$sleep 5" -P $$
39if [ $? -eq 0 ]; then
40	echo "ok 4 - $name"
41else
42	echo "not ok 4 - $name"
43fi
44rm -f $sleep
45