Re: delle variabili in bash e in php

Francesco Potortì <[email protected]>
Newsgroups gmane.linux.debian.user.italian
Organization CNR-ISTI, via Moruzzi 1, I-56124 Pisa, +39-0503153058
Message-ID <[email protected]>
>while [ NOW -lt $c ]
>  do
>   sleep 20
>   aggiorna-status-variabili
>   if [VAR-A -lt $a && VAR-B -lt $b ]
>   then
>     esegui-quello-che-deve-fare
>     break
>   else
>     sleep 20
>     aggiorna-status-variabili
>   fi
>  done
>
>ora NOW è il tempo ... come la infilo nel loop (ossia il loop attende che 
>si verifichino de condizioni su VAR-A e VAR-B, ma solo fino a un certo 
>orario.

Qualcosa del tipo

((maxwait = 600))
((loopwait = 20))
while true; do
  curtime=$(date +%s)
  ((deadline = curtime+maxwait))
  while sleep $((loopwait)); do
    curtime=$(date +%s)
    if condition_is_met || ((curtime > deadline))
      do_something
      break
    fi
  done
done
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.