unset num[@] sum; c=-1
while num[c+=1]=$RANDOM
do case $c in ([2-7]?) ;;
($((sum+=num[c])):|99) ! eval '
printf "$@$sum" "$'"$((sum<$3?2:4))\" greater";;
(19) set "The sum of the %-5s 20 elements is:\t%s\n" \
first "$sum" last ""; sum=0
esac||break
done
The sum of the first 20 elements is: 308347
The sum of the last 20 elements is: 306596
The sum of the first 20 elements is: greater
Далеко ли
wait; for i in 1 2 3 4; do echo -e "$ESC[41m$ESC[2J"; sleep 0.2; echo -e "$ESC[0m$ESC[2J"; sleep 0.2; done
понял? Обратите внимание, что содержимое экрана теряется, и не каждый эмулятор терминала распознает коды консоли VT100.