if statement help

sam srf10130 at vtc.vsc.edu
Tue Sep 29 22:59:26 UTC 2009


Ray Parrish wrote:
> Nils Kassube wrote:
>> Ray Parrish wrote:
>>   
>>> nowDay=$(date +%A);
>>>     
>> The ";" at the end is not needed.
>>
>>   
>>> AMorPM=$(date +%H):
>>>     
>> The ":" at the end is wrong, probably you wanted to write
>>
>> AMorPM=$(date +%H);
>>
>> but again the ";" at the end is not needed.
>>
>>   
>>> padsp espeak "$nowTime hours":
>>>     
>> Again ":" is wrong (unless you really want to pass it to espeak).
>>
>>   
>>> if [$AMorPM -lt 12]
>>>     
>> That should be:
>>
>> if [ $AMorPM -lt 12 ]
>>
>>
>> Nils
>>   
> I tried adding the spaces, and still it bombs and says PM only.
> 
> Later, Ray Parrish
> 
> 
Recall that the use of the square brackets calls the command "test", for
which you can pull up the man page. I regularly have to pull this man
page because test seems to give me results that I'm not expecting
(usually ends up being a syntax error on my part). I find it (test)
un-intuitive myself but usually figure it out eventually.

HTH
Sam





More information about the ubuntu-users mailing list