Introducing UNIX and Linux |
More on shellsOverview |
Answer to chapter 8 question 5Use # Format %H gives the hour as 2 digits, 00-23 case $( date "+%H" ) in # Any hour 00 to 09, also 10 or 11 0?|1[01]) echo Good Morning ;; # Any hour 12 to 17 1[2-7]) echo Good afternoon ;; # Any other time is evening *) echo Good evening ;; esac |
Copyright © 2002 Mike Joy, Stephen Jarvis and Michael Luck