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