weird while shellscript problem

Manuel Arostegui Ramirez manuel at
Thu Jun 7 13:00:00 UTC 2007

Hi folks

I'm completely lost due to probably I'm missing something but I cannot find 
what is it.
I'm porting an AIX shell script to linux.
It's supposed to run between two hours the user select in a .conf file
which is more or less something like:

min_hour 9

max_hour 11

If the user launch the script at for example 8 it won't run, again, it will 
only run between 9 and 11.

To do that I'm using this piece of code:

while [ 1 ]
        if [ "$MAX_HOUR" != "$MIN_HOUR" ]
                while [ $CURRENT_HOUR -lt $MIN_HOUR ] || [ $CURRENT_HOUR -gt 
                        CURRENT_HOUR=`date +"%H"`
                        echo "Waiting to valid time ($MIN_HOUR - $MAX_HOUR, 
current $CURRENT_HOUR)" >> $LOGFILE.err
                        sleep 300

The problem actually is that if I set an hour which is not between the 
interval the script is allowed to run...I'd run anyways
So the problem is the comparation, I guess...
It runs perfectly in AIX
Any ideas will be apreciated


Manuel Arostegui Ramirez.

Electronic Mail is not secure, may not be read every day, and should not
be used for urgent or sensitive issues.

More information about the fedora-list mailing list