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.

# Esempi:<br />

# Smith e Smythe hanno entrambi co<strong>di</strong>ce soundex "S-530".<br />

# Harrison = H-625<br />

# Hargison = H-622<br />

# Harriman = H-655<br />

Appen<strong>di</strong>ce A. Script aggiuntivi<br />

# Nella pratica tutto questo funziona piuttosto bene,<br />

#+ sebbene ci siano alcune anomalie.<br />

#<br />

#<br />

# Lo U.S. Census e alcune altre agenzie governative, utilizzano il soundex<br />

# per effettuare ricerche genealogiche.<br />

#<br />

# Per ulteriori informazioni,<br />

#+ ve<strong>di</strong> la "National Archives and Records Administration home page",<br />

#+ http://www.nara.gov/genealogy/soundex/soundex.html<br />

# Esercizio:<br />

# ---------<br />

# Semplificate la sezione "Gestione delle Eccezioni" dello script.<br />

exit 0<br />

# [N.d.T.]<br />

# 1 - M. Cooper usa il termine "name" che ho tradotto, ovviamente, con "nome".<br />

# In realtà la documentazione riguardante la co<strong>di</strong>fica soundex usa<br />

# il termine "surname", vale a <strong>di</strong>re "cognome" (ed infatti sono dei cognomi<br />

# quelli riportati dallo stesso Cooper negli esempi presentati<br />

# nello script).<br />

# 2 - Gioco <strong>di</strong> parole intraducibile in italiano basato sul <strong>di</strong>verso significato<br />

# che la parola "pipe" assume nell’ambito dello <strong>scripting</strong> <strong>di</strong> shell (dove<br />

# non viene tradotta) e nell’uso comune, cioè "condotto, tubo,<br />

# canna, ecc.". La frase tradotta letteralmente risulterebbe:<br />

# "La precedente sostituzione <strong>di</strong> comando ha installato più tubi <strong>di</strong><br />

# un idraulico". è l’abbreviazione della parola inglese<br />

# "grin", vale a <strong>di</strong>re "sorriso".<br />

# 3 - L’autore ha usato il verbo "to bollix up" che in gergo significa appunto<br />

# "incasinare". Non si tratta, quin<strong>di</strong>, <strong>di</strong> una mia licenza.<br />

Esempio A-10. “Game of Life”<br />

#!/bin/bash<br />

# life.sh: "Life in the Slow Lane"<br />

# Version 2: Patched by Daniel Albers<br />

#+ to allow non-square grids as input.<br />

# ##################################################################### #<br />

# This is the <strong>Bash</strong> script version of John Conway’s "Game of Life". #<br />

# "Life" is a simple implementation of cellular automata. #<br />

624

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

Saved successfully!

Ooh no, something went wrong!