Can anyone help with this simple script? It is right out a Unix manual I have. I get the error below:
hour=`date | cut -c12-13`
case $hour in
[$hour -lt 12] ) echo "Good Morning" ;;
[$hour -lt 18] ) echo "Good Afternoon" ;;
*) echo "Good Evening" ;;
esac
exit 0
ERROR
./greetings: line 3: syntax error near unexpected token `$hour'
./greetings: line 3: ` [ $hour -lt 12 ] ) echo "Good Morning" ;;'
hour=`date | cut -c12-13`
case $hour in
[$hour -lt 12] ) echo "Good Morning" ;;
[$hour -lt 18] ) echo "Good Afternoon" ;;
*) echo "Good Evening" ;;
esac
exit 0
ERROR
./greetings: line 3: syntax error near unexpected token `$hour'
./greetings: line 3: ` [ $hour -lt 12 ] ) echo "Good Morning" ;;'