#!/bin/sh
PRINTF=/usr/bin/printf
MACHINE_NAME=`uname -n`
TIME=`date +"%H"`
$PRINTF "Welcome to $MACHINE_NAME. What is your name?\n"
read NAME
if [ $TIME -lt 12 -a $TIME -gt 0 ]; then
$PRINTF "Good morning $NAME, how are you?\n"
elif [ $TIME -ge 12 -a $TIME -lt 18 ]; then
$PRINTF "Good afternoon $NAME, how are you?\n"
else
$PRINTF "Good evening $NAME, how are you?\n"
fi
read RESPOND
if [ "$REPOND" = "good" ]; then
$PRINTF "Im glad to hear that.\n"
else
$PRINTF "Im sorry to hear that. Hope you feel better soon.\n"
fi
This code runs error since I type "good" after "how are you", it goes to "Im sorry to hear that. Hope you feel better soon."
Is that's right by using "$REPOND" = "good" in if conditions?
Please help me fix it,Thx a lot!