xref: /freebsd/bin/pkill/tests/pkill-t_test.sh (revision aa24f48b361effe51163877d84f1b70d32b77e04)
1#!/bin/sh
2# $FreeBSD$
3
4base=`basename $0`
5
6echo "1..2"
7
8name="pkill -t <tty>"
9tty=`ps -x -o tty -p $$ | tail -1`
10if [ "$tty" = "??" -o "$tty" = "-" ]; then
11	tty="-"
12	ttyshort="-"
13else
14	case $tty in
15	pts/*)	ttyshort=`echo $tty | cut -c 5-` ;;
16	*)	ttyshort=`echo $tty | cut -c 4-` ;;
17	esac
18fi
19sleep=$(pwd)/sleep.txt
20ln -sf /bin/sleep $sleep
21$sleep 5 &
22sleep 0.3
23pkill -f -t $tty $sleep
24ec=$?
25case $ec in
260)
27	echo "ok 1 - $name"
28	;;
29*)
30	echo "not ok 1 - $name"
31	;;
32esac
33$sleep 5 &
34sleep 0.3
35pkill -f -t $ttyshort $sleep
36ec=$?
37case $ec in
380)
39	echo "ok 2 - $name"
40	;;
41*)
42	echo "not ok 2 - $name"
43	;;
44esac
45rm -f $sleep
46