2014-03-04 112 views
1

首先,我是一個大白菜,而且我表示要研究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 

什麼是我做錯了嗎?你有什麼主意嗎?

此外,

 
[[email protected] ~]$ whereis ksh 
ksh: /bin/ksh /usr/share/man/man1/ksh.1.gz 

我使用紅帽。

+1

縮進你的代碼。你可能自己想象這個問題! – devnull

+0

Sssh ..不要告訴任何人。 (你只有一個'fi'。) – devnull

+0

感謝你的提示。 我需要另一個! :D祝你有美好的一天。 – makemesteaks

回答

0

看起來你在那裏缺少'fi'。