KSH中出现意外错误

时间:2014-03-04 08:52:55

标签: shell ksh

首先,我是一个大菜鸟,我已经学会了学习KSH。

我已经按照一些教程进行了操作,然后我开始使用这段代码:

#!/bin/ksh


print
print "Please enter the type of "
print "back you want done:[ABCD]."

print "A: Daily"
print "B: Weekly"
print "C: Quarterly"
print "D: Special"

print

print -n "Response: "
read response

print

if [[ $response = [Aa] ]]
then
print "Starting daily backup"

elif [[ $response = [Bb] ]]
then
print "starting weekly backup"

elif [[ $response = [Cc] ]]
then
print "starting weekly backup"

elif [[ $response = [Dd] ]]
then
print "starting special backup"
print
print "Please enter the type of "
print "back you want done:[ABCD]."

print "A: Daily"
print "B: Weekly"
print "C: Quarterly"
print "D: Special"

print

print -n "Response: "
read response

print

if [[ $response = [Aa] ]]
then
print "Starting daily backup"

elif [[ $response = [Bb] ]]
then
print "starting weekly backup"

elif [[ $response = [Cc] ]]
then
print "starting weekly backup"

elif [[ $response = [Dd] ]]
then

print "starting daily backup"

print
print "please take out daily tapes."
print "Please put in weekly tapes,"
print -n "and hit 'enter' to continue."
read waiting

print
print "starting weekly backup"

else

print "'$response' is not a valid option."
fi 

现在我有一个错误:

./backup.ksh: line 18: syntax error at line 82: `then' unmatched

我做错了什么?你有什么想法吗?

此外,

[someuser@5278752 ~]$ whereis ksh
ksh: /bin/ksh /usr/share/man/man1/ksh.1.gz

我正在使用redhat。

1 个答案:

答案 0 :(得分:0)

看起来你在那里缺少'fi'。

相关问题