if statement help

David C. Uhrig david at twintop-tahoe.com
Tue Sep 29 19:10:14 UTC 2009


On Tue, Sep 29, 2009 at 12:01 PM, Ray Parrish <crp at cmc.net> wrote:
> nowDay=$(date +%A);
> nowDate=$(date +%d%B%Y);
> nowTime=$(date +%H:%M);
> AMorPM=$(date +%H):
> padsp espeak "$nowDay";
> padsp espeak "$nowDate";
> padsp espeak "$nowTime hours":
> if [$AMorPM -lt 12]
> then padsp espeak "AM";
> else
>        padsp espeak "PM";
> fi
>
> Can anyone tell me why this always says PM, even when %H returns values
> lower than 12???
>
> Thanks for any help you can be.
>
> Later, Ray Parrish
>
> --
> The Future of Technology.
> http://www.rayslinks.com/The%20Future%20of%20Technology.html
> Ray's Links, a variety of links to usefull things, and articles by Ray.
> http://www.rayslinks.com
> Writings of "The" Schizophrenic, what it's like to be a schizo, and other
> things, including my poetry.
> http://www.writingsoftheschizophrenic.com
>
>
> --
> ubuntu-users mailing list
> ubuntu-users at lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
>

Hi Ray,

    I'm not sure why it is not working with %H, but why not use %p for
AM/PM instead of comparing the %H value?

-David C. Uhrig




More information about the ubuntu-users mailing list