Update of /cvsroot/winbash/winbash/tests/misc
In directory usw-pr-cvs1:/tmp/cvs-serv6262/tests/misc
Added Files:
chld-trap.sh dot-test-1.sh dot-test-1.sub gotest perf-script
redir.t1.sh redir.t2.sh redir.t3.sh redir.t3.sub redir.t4.sh
run.r1.sh run.r2.sh run.r3.sh sigint.t1.sh sigint.t2.sh
sigint.t3.sh sigint.t4.sh test-minus-e.1 test-minus-e.2
Log Message:
Major realignment to 1.14.7
--- NEW FILE: chld-trap.sh ---
#! /bin/sh
#
# show that setting a trap on SIGCHLD is not disastrous.
#
trap 'echo caught a child death' SIGCHLD
sleep 5 &
sleep 5 &
sleep 5 &
wait
exit 0
--- NEW FILE: dot-test-1.sh ---
echo this is $0
. ./dot-test-1.sub
echo after . dot-test-1.sub
--- NEW FILE: dot-test-1.sub ---
echo this is dot-test-1.sub
--- NEW FILE: gotest ---
aflag=
bflag=
while getopts ab: name
do
case $name in
a) aflag=1 ;;
b) bflag=1
bval=$OPTARG;;
?) echo Usage: $0 [-a] [-b value] args
exit 2;;
esac
done
if [ ! -z "$aflag" ] ; then echo -a specified ; fi
if [ ! -z "$bflag" ] ; then echo -b $bval specified ; fi
if [ "$OPTIND" -gt 1 ]
then
shift $(( $OPTIND - 1 ))
fi
echo remaining args: "$*"
exit 0
--- NEW FILE: perf-script ---
#!/bin/bash
typeset -i m2 m1 M n2 n1 N m n
typeset -i MM=5 NN=5
case $# in
0) :
;;
1) MM=$1; NN=$1
;;
2) MM=$1; NN=$2
;;
*) echo 1>&2 "Usage: $0 [m [n]]"
;;
esac
EMPTYLINE=: # echo
echo 'a = { ' # mathematica
let "M=1" # for (M=1; M<=MM; M++)
while let "M <= MM"; do
let "N=1" # for (N=1; N<=NN; N++)
while let "N <= NN"; do
let "m1 = M - 1"
let "m2 = M + 1"
let "n1 = N - 1"
let "n2 = N + 1"
echo -n '{ ' # math
let "m=1" # for(m=1; m<=MM; m++)
while let "m <= MM"; do
let "n=1" # for(n=1; n<=NN; n++)
while let "n <= NN"; do
let "x = (m-m1)*(m-M)*(m-m2)"
let "y = (n-n1)*(n-N)*(n-n2)"
if let "(x*x + (n-N)*(n-N)) * ((m-M)*(m-M) + y*y)"; then
echo -n "0,"
else # neighbour
echo -n "1,"
fi
let "n=n+1"
done
echo -n " "; let "m=m+1" # ". "
done
echo '},'
let "N=N+1"
$EMPTYLINE
done
$EMPTYLINE
let "M=M+1"
done
echo '}'
echo -n 'o = { '
let "m=1"
while let "m <= MM"; do
let "n=1"
while let "n <= NN"; do
echo -n "1,"
let "n=n+1"
done
let "m=m+1"
done
echo " }"
echo 'x = LinearSolve[a,o] '
exit 0
--- NEW FILE: redir.t1.sh ---
read line1
echo read line1 \"$line1\"
exec 4</etc/passwd
exec 5<&0
exec 0<&4
read line2
echo read line2 \"$line2\"
exec 0<&5
read line3
echo read line3 \"$line3\"
exec 0<&4
read line4
echo read line4 \"$line4\"
exec 4<&-
--- NEW FILE: redir.t2.sh ---
read line1
echo read line 1 \"$line1\"
exec 4<&0
exec 0</dev/tty
read line2
echo line read from tty = \"$line2\"
exec 0<&4
read line3
echo read line 3 \"$line3\"
--- NEW FILE: redir.t3.sh ---
#
# Test the effect of input buffering on the shell's input
#
echo this is redir.t3.sh
exec 0< redir.t3.sub
echo after exec in redir.t3.sh
--- NEW FILE: redir.t3.sub ---
echo this is redir-test-3.sub
--- NEW FILE: redir.t4.sh ---
echo "Point 1"
exec 3</etc/passwd
exec 4>a
exec 5>b
echo "Point 2"
echo to a 1>&4
echo to b 1>&5
exec 11</etc/printcap
echo "Point 3"
echo to a 1>&4
echo to b 1>&5
exit 0
--- NEW FILE: run.r1.sh ---
../../bash redir.t1.sh
--- NEW FILE: run.r2.sh ---
../../bash ./redir.t2.sh < /etc/passwd
--- NEW FILE: run.r3.sh ---
#
# the `after exec in ...' should not be echoed
../../bash < redir.t3.sh
--- NEW FILE: sigint.t1.sh ---
echo before trap
trap 'echo caught sigint' 2
echo after trap
for i in 1 2 3
do
echo $i
sleep 5
done
--- NEW FILE: sigint.t2.sh ---
echo before loop
for i in 1 2 3
do
echo $i
sleep 5
done
--- NEW FILE: sigint.t3.sh ---
sleep 5 &
sleep 5 &
sleep 5 &
echo wait 1
wait
echo wait 2
wait
exit
--- NEW FILE: sigint.t4.sh ---
trap 'echo sigint' 2
sleep 5 &
sleep 5 &
sleep 5 &
echo wait 1
wait
echo wait 2
wait
exit
--- NEW FILE: test-minus-e.1 ---
touch .file
while set -e ; test -r .file ; do
echo -n "stop loop? "
read reply
case "$reply" in
y*) rm .file non-dash-file ;;
esac
set +e
done
--- NEW FILE: test-minus-e.2 ---
touch .file
set -e
while set +e ; test -r .file ; do
echo -n "stop loop? [yes to quit] "
read reply
if [ "$reply" = yes ] ; then
rm .file non-dash-file
fi
set -e
done
rm -f .file
|