Question

First of all I'm a big noob, and I've strated to study KSH.

I have followed some tutorials, and I got up to this code:

#!/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 

And Now I have an error in:

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

What is that I'm doing wrong? Do you have any idea?

Also,

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

I'm using redhat.

Was it helpful?

Solution

Looks like you're missing 'fi' in there.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top