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.

$HOSTTYPE<br />

$IFS<br />

tipo <strong>di</strong> macchina<br />

Come $MACHTYPE, identifica il sistema hardware, ma in forma ridotta.<br />

bash$ echo $HOSTTYPE<br />

i686<br />

separatore <strong>di</strong> campo (internal field separator)<br />

Capitolo 9. Variabili riviste<br />

Questa variabile determina il modo in cui <strong>Bash</strong> riconosce i campi, ovvero le singole parole,<br />

nell’interpratazione delle stringhe <strong>di</strong> caratteri.<br />

Il valore preimpostato è una spaziatura (spazio, tabulazione e ritorno a capo), ma può essere<br />

mo<strong>di</strong>ficato, per esempio, per verificare un file dati che usa la virgola come separatore <strong>di</strong> campo. E’<br />

da notare che $* utilizza il primo carattere contenuto in $IFS. Ve<strong>di</strong> Esempio 5-1.<br />

bash$ echo $IFS | cat -vte<br />

$<br />

bash$ bash -c ’set w x y z; IFS=":-;"; echo "$*"’<br />

w:x:y:z<br />

98

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

Saved successfully!

Ooh no, something went wrong!