Hi all. I'm trying to write a script that will only run hourly between 7am and 7pm. To that end, I want to use expr to evalutate whether the current hour falls in that range. I am experiencing some odd behavior however.
It would seem that expr evaluates to 1 if the expression is false? That doesn't make sense to me, but I'm not used to bash programing. Any advice is apprecaited.
Code:
[user@server documents]# if [ `expr 3 < 2` ]; then echo "hi there"; fi
hi there
[user@server documents]#
...
[user@server documents]# if [ `expr 3 > 2` ]; then echo "hi there"; fi
[user@server documents]#
It would seem that expr evaluates to 1 if the expression is false? That doesn't make sense to me, but I'm not used to bash programing. Any advice is apprecaited.