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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

if [ $# -ne "$CONTOARG" ]<br />

then<br />

echo "Utilizzo: ‘basename $0‘ NOME-UTENTE"<br />

exit $E_ERR_ARG<br />

fi<br />

Capitolo 23. Funzioni<br />

ricerca () # Esamina il file alla ricerca del modello, quin<strong>di</strong> visualizza<br />

#+ la parte rilevante della riga.<br />

{<br />

while read riga # "while" non necessariamente vuole la "[ con<strong>di</strong>zione]"<br />

do<br />

echo "$riga" | grep $1 | awk -F":" ’{ print $5 }’ # awk deve usare<br />

#+ i ":" come delimitatore.<br />

done<br />

}

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

Saved successfully!

Ooh no, something went wrong!