11.04.2013 Views

Guida avanzata di scripting Bash - Portale Posta DMI

Guida avanzata di scripting Bash - Portale Posta DMI

Guida avanzata di scripting Bash - Portale Posta DMI

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

$UID<br />

echo "Ti chiami $nome."<br />

else<br />

echo "Tempo scaduto."<br />

fi<br />

echo<br />

Capitolo 9. Variabili riviste<br />

# Il comportamento <strong>di</strong> questo script è un po’ <strong>di</strong>verso da "timed-input.sh".<br />

# Ad ogni pressione <strong>di</strong> tasto, la temporizzazione ricomincia da capo.<br />

exit 0<br />

Forse, il metodo più semplice è quello <strong>di</strong> usare read con l’opzione -t.<br />

Esempio 9-4. read temporizzato<br />

#!/bin/bash<br />

# t-out.sh<br />

# Ispirato da un suggerimento <strong>di</strong> "syngin seven" (grazie).<br />

TEMPOLIMITE=4 # 4 secon<strong>di</strong><br />

read -t $TEMPOLIMITE variabile

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!