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.

while :<br />

do<br />

operazione-1<br />

operazione-2<br />

...<br />

operazione-n<br />

done<br />

# Uguale a:<br />

# while true<br />

# do<br />

# ...<br />

# done<br />

Istruzione nulla in un costrutto if/then:<br />

if con<strong>di</strong>zione<br />

then : # Non fa niente e salta alla prossima istruzione<br />

else<br />

fa-qualcosa<br />

fi<br />

Capitolo 3. Caratteri speciali<br />

Fornisce un segnaposto dove è attesa un’operazione binaria, ve<strong>di</strong> Esempio 8-2 e parametri<br />

predefiniti.<br />

: ${nomeutente=‘whoami‘}<br />

# ${nomeutente=‘whoami‘} Senza i : iniziali dà un errore,<br />

# tranne se "nomeutente" è un comando o un builtin ...<br />

Fornisce un segnaposto dove è atteso un comando in un here document. Ve<strong>di</strong> Esempio 17-10.<br />

Valuta una stringa <strong>di</strong> variabili utilizzando la sostituzione <strong>di</strong> parametro (come in Esempio 9-14).<br />

: ${HOSTNAME?} ${USER?} ${MAIL?}<br />

# Visualizza un messaggio d’errore se una, o più, delle variabili<br />

#+ fondamentali d’ambiente non è impostata.<br />

Espansione <strong>di</strong> variabile / sostituzione <strong>di</strong> sottostringa.<br />

15

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

Saved successfully!

Ooh no, something went wrong!