weird while shellscript problem
Manuel Arostegui Ramirez
manuel at todo-linux.com
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:
MIN_HOUR=0
MAX_HOUR=0
while [ 1 ]
do
if [ "$MAX_HOUR" != "$MIN_HOUR" ]
then
while [ $CURRENT_HOUR -lt $MIN_HOUR ] || [ $CURRENT_HOUR -gt
$MAX_HOUR ]
do
CURRENT_HOUR=`date +"%H"`
echo "Waiting to valid time ($MIN_HOUR - $MAX_HOUR,
current $CURRENT_HOUR)" >> $LOGFILE.err
sleep 300
done
fi
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
Thanks
Manuel
--
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 users
mailing list