[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



El Jueves, 7 de Junio de 2007 15:00, Manuel Arostegui Ramirez escribió:
> 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
>

I forgot this part, which is the one that drives me mad:

line 194: [: -lt: unary operator expected

And line 194 is while [ $CURRENT_HOUR -lt $MIN_HOUR ] || [ $CURRENT_HOUR
 -gt $MAX_HOUR ]

Cheers



-- 
Manuel Arostegui Ramirez.

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


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]
  Powered by Linux