avalee//home/javalee/lx>cat js
#! /bin/ksh
#scriptname:js
#the script is example about co-process
echo "WELCOME TO THE CALCULATOR PROGRAM"
bc |&
while true
do
echo "Select one of the opertors"
echo "a)=+ s)=- m)=* d)=/ q)=quit"
read op
case $op in
a) op="+" ;;
s) op="-" ;;
m) op="*" ;;
d) op="/" ;;
q|Q) op="q" exit ;;
*) print "wrong option,input again..." ; sleep 1
continue ;;
esac
print -p scale=3
echo -n "please enter two numbers:"
read n1 n2
print -p "$n1" "$op" "$n2"
read -p result
print $result
print -n "continue (y/n)? "
read answer
case $answer in
[Nn]*)
break;;
esac
done
print "Good bey"