I am completely new to scripting, so take it easy on me, thanks. I use the command 'bash greetings2' and receieve...
greetings2: line 17: unexpected EOF while looking for matching `"' greetings2: line 21: syntax error: unexpected end of file.
1 #
2 # greetings2
3 # greetings program version 2
4 # A sample program using the if-then-elif construct
5 # This program displays greetings according to the time of day
6 # Version2: using the date command format control option
7 #
8 echo # skip a line
9 hour=`date +%H` # store the part of the date string that shows the hour
10 if [ "$hour" -le 18 ] # check for the morning hours
11 then
12 echo "GOOD MORNING"
13 elif [ "$hour -le 18 ] # check for the afternoon hours
14 then
15 echo "GOOD AFTERNOON"
16 else #it must be evening
17 echo "GOOD EVENING"
18 fi
19 echo # skip a line
20 exit 0 # end of the program, exit