This is my homework, but I only need help on a few things. I'm writing a script to convert user inputted variables to all lowercase and then all uppercase. And then comparing the variables using the if loop. Here's my script:
#!/bin/ksh
# He Chen
# Assignment 10, a10b, Apr 25
# Greet user in Korn shell
print "Welcome, please enter your first and last name."
read first last
#print $first $last
# convert names to lowercase
set typeset -l first="$first"
set typeset -l last="$last"
print $first $last
if [[ ${first1} = tom && ${last1} = jones ]] then
print "Welcome, Tom Jones."
# convert names to uppercase
set typeset -u $first $last
elif [[ ${first} != tom && ${last} != jones ]] then
print "Are you happy today, $first $last?"
fi
When I execute the script, the typeset command doesn't work (see the print $first $last) and the if loops won't work. Any help? I've search my textbook, and the powerpoints from my teacher. None of which helped.
EDIT: I'm not sure if this forum is the right place, but it's the best match for my question.
#!/bin/ksh
# He Chen
# Assignment 10, a10b, Apr 25
# Greet user in Korn shell
print "Welcome, please enter your first and last name."
read first last
#print $first $last
# convert names to lowercase
set typeset -l first="$first"
set typeset -l last="$last"
print $first $last
if [[ ${first1} = tom && ${last1} = jones ]] then
print "Welcome, Tom Jones."
# convert names to uppercase
set typeset -u $first $last
elif [[ ${first} != tom && ${last} != jones ]] then
print "Are you happy today, $first $last?"
fi
When I execute the script, the typeset command doesn't work (see the print $first $last) and the if loops won't work. Any help? I've search my textbook, and the powerpoints from my teacher. None of which helped.
EDIT: I'm not sure if this forum is the right place, but it's the best match for my question.