I am supposed to write a file called greetings that uses the cut command to calculate the hour of day, and after it calculates that I am supposed to display a message like "good morning" good afternoon, or good evening. After running the program I get an error:
jawaibel@cis:~$ bash greettings
21
greettings: line 10: [: missing `]'
greettings: line 13: [: missing `]'
good evening
jawaibel@cis:~$ vi greetttings
jawaibel@cis:~$ vi greettings
1 #
2 # greetings
3 # greetings program version 1
4 # A sample program using the if - then -elif construct
5 # This program displays greetings according to the time of day
6 #
7 echo
8 echo
9 hour= date | cut -c12-13
10 if ["$hour" -le 10]
11 then
12 echo good morning
13 elif ["$hour" -le 12]
14 then
15 echo good afternoon
16 else
17 echo good evening
18 fi
19 echo
20 exit 0
~
~
~
"greettings" 20L, 329C 10,1 All
any help is greatly appreciated
jawaibel@cis:~$ bash greettings
21
greettings: line 10: [: missing `]'
greettings: line 13: [: missing `]'
good evening
jawaibel@cis:~$ vi greetttings
jawaibel@cis:~$ vi greettings
1 #
2 # greetings
3 # greetings program version 1
4 # A sample program using the if - then -elif construct
5 # This program displays greetings according to the time of day
6 #
7 echo
8 echo
9 hour= date | cut -c12-13
10 if ["$hour" -le 10]
11 then
12 echo good morning
13 elif ["$hour" -le 12]
14 then
15 echo good afternoon
16 else
17 echo good evening
18 fi
19 echo
20 exit 0
~
~
~
"greettings" 20L, 329C 10,1 All
any help is greatly appreciated