KSH错误行26:第41行的语法错误:'done'意外

lec*_*rdo 0 ksh

当我在终端上输入超过1个参数时,继续遇到这个问题:

./learn 1 2

我从while循环中得出结论,但评论的东西没有达到原因.

#!/bin/ksh
#
count=$#

if test $count -lt 1
then
    echo "Enter at least 1 number"
    exit
elif test $count -gt 9
then
    echo "Enter max 9 numbers"
    exit
else
    echo "Parameter check: PASSED"
fi

set -A numbers $@
first=${numbers[0]}

if test $count -eq 1
then
    echo "$first = $first"
    exit
else
    sum=$first
    printf "$first + "
fi

while test "$count" -gt 1
do
    shift
    first=${numbers[0]}
    ((sum = sum + first))
    if test $count -gt 2
    then
    printf "$first + "
    else
    printf "$first = $sum"
    fi
    ((count = count - 1)
done 
Run Code Online (Sandbox Code Playgroud)

它基本上是一个程序,接收用户输入...即从屏幕1 2 3并加在一起给一个总和

Gun*_*ica 5

前一行done,

((count = count - 1)
Run Code Online (Sandbox Code Playgroud)

有两个开口,但只有一个闭合支架.