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.

Lista delle Tabelle<br />

11-1. Identificatori <strong>di</strong> job .........................................................................................................................222<br />

30-1. Opzioni bash...................................................................................................................................528<br />

33-1. Numeri che rappresentano i colori nelle sequenze <strong>di</strong> escape .........................................................561<br />

B-1. Variabili speciali <strong>di</strong> shell..................................................................................................................761<br />

B-2. Operatori <strong>di</strong> verifica: confronti binari..............................................................................................761<br />

B-3. Operatori <strong>di</strong> verifica: file..................................................................................................................762<br />

B-4. Sostituzione ed espansione <strong>di</strong> parametro.........................................................................................763<br />

B-5. Operazioni su stringhe .....................................................................................................................764<br />

B-6. Costrutti vari ....................................................................................................................................765<br />

C-1. Operatori sed <strong>di</strong> base .......................................................................................................................767<br />

C-2. Esempi <strong>di</strong> operatori sed ...................................................................................................................769<br />

D-1. Co<strong>di</strong>ci <strong>di</strong> Exit “riservati” .................................................................................................................775<br />

L-1. Parole chiave / variabili / operatori dei file batch e loro equivalenti <strong>di</strong> shell ...................................806<br />

L-2. Coman<strong>di</strong> DOS e loro equivalenti UNIX ..........................................................................................807<br />

N-1. Cronologia delle revisioni ...............................................................................................................823<br />

Lista degli Esempi<br />

2-1. cleanup: Uno script per cancellare i file <strong>di</strong> log in /var/log...................................................................4<br />

2-2. cleanup: Lo script clean-up migliorato................................................................................................4<br />

2-3. cleanup: Una versione <strong>avanzata</strong> e generalizzata degli script precedenti. ............................................4<br />

4-4. Intero o stringa?..................................................................................................................................42<br />

5-1. Visualizzare strane variabili ...............................................................................................................50<br />

6-1. exit / exit status...................................................................................................................................60<br />

7-1. Cos’è vero?.........................................................................................................................................63<br />

7-2. Equivalenza <strong>di</strong> test, /usr/bin/test, [ ] e /usr/bin/[.................................................................67<br />

7-3. Verifiche aritmetiche utilizzando (( )) ................................................................................................69<br />

7-4. Ricerca <strong>di</strong> link interrotti (broken link) ...............................................................................................72<br />

7-5. Confronti numerici e <strong>di</strong> stringhe ........................................................................................................77<br />

7-6. Verificare se una stringa è nulla .........................................................................................................78<br />

7-7. zmore .................................................................................................................................................80<br />

8-4. Rappresentazione <strong>di</strong> costanti numeriche ............................................................................................92<br />

9-10. Inserire una riga bianca tra i paragrafi <strong>di</strong> un file <strong>di</strong> testo................................................................118<br />

9-13. Mo<strong>di</strong> alternativi <strong>di</strong> estrarre sottostringhe .......................................................................................125<br />

9-14. Sostituzione <strong>di</strong> parametro e messaggi d’errore ..............................................................................130<br />

9-15. Sostituzione <strong>di</strong> parametro e messaggi “utilizzo”............................................................................131<br />

9-17. Ricerca <strong>di</strong> corrispondenza nella sostituzione <strong>di</strong> parametro............................................................133<br />

9-18. Rinominare le estensioni dei file: ...................................................................................................134<br />

9-21. Utilizzare declare per tipizzare le variabili....................................................................................140<br />

9-22. Referenziazioni in<strong>di</strong>rette ................................................................................................................142<br />

9-23. Passare una referenziazione in<strong>di</strong>retta a awk ..................................................................................144<br />

9-24. Generare numeri casuali.................................................................................................................145<br />

9-25. Scegliere una carta a caso dal mazzo .............................................................................................147<br />

9-26. Numero casuale in un intervallo dato.............................................................................................149<br />

9-27. Lanciare un dado con RANDOM...................................................................................................153<br />

vii

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

Saved successfully!

Ooh no, something went wrong!