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.

# Esempio fornito da Kenny Stauffer,<br />

#+ leggermente mo<strong>di</strong>ficato dall’autore del libro.<br />

E_FILE_ERRATO=65<br />

Capitolo 17. Here document<br />

read -p "File: " file # L’opzione -p <strong>di</strong> ’read’ visualizza il prompt.<br />

if [ ! -e "$file" ]<br />

then # Termina l’esecuzione se il file non esiste.<br />

echo "File $file non trovato."<br />

exit $E_FILE_ERRATO<br />

fi<br />

read -p "Titolo: " titolo<br />

cat - $file

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

Saved successfully!

Ooh no, something went wrong!