#!/bin/csh
#
# Time of day greeting
#
# usage: greet [hour between 0-23]
#
if ($#argv == 0) then
set hour = �date +%H�
else
set hour = $argv[1]
endif
#
if ($hour < 12) then
echo "Good Morning\!"
else
if ($hour < 18) then
echo "Good Afternoon\!"
else
echo "Good Evening\!"
endif
endif
#
exit 0
#
Why does the line set hour = �date +%H� not work correctly?
I get an if: Expression syntax.
back-quotes, not single quotes.
set hour = `date +%H`
---------- Post updated at 03:08 PM ---------- Previous update was at 03:08 PM ----------
To keep the forums high quality for all users, please take the time to format your posts correctly.
First of all, use Code Tags when you post any code or data samples so others can easily read your code. You can easily do this by highlighting your code and then clicking on the # in the editing menu. (You can also type code tags
```text
and
```
by hand.)
Second, avoid adding color or different fonts and font size to your posts. Selective use of color to highlight a single word or phrase can be useful at times, but using color, in general, makes the forums harder to read, especially bright colors like red.
Third, be careful when you cut-and-paste, edit any odd characters and make sure all links are working property.
Thank You.
The UNIX and Linux Forums
Thank you so much!
sorry for the noob question but this was driving me crazy.