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.

Appen<strong>di</strong>ce B. Tabelle <strong>di</strong> riferimento<br />

Operatore Verifica se ----- Operatore Verifica se<br />

-S Il file è un socket -k È impostato lo<br />

“sticky bit”<br />

-t Il file è associato a<br />

un terminale<br />

-N Il file è stato<br />

mo<strong>di</strong>ficato<br />

dall’ultima lettura<br />

-O Si è il proprietario<br />

del file<br />

-G L’id <strong>di</strong> gruppo del<br />

file è uguale al<br />

vostro<br />

! “NOT” (inverte il<br />

senso delle<br />

precedenti verifiche)<br />

* Operatore binario (richiede due operan<strong>di</strong>).<br />

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

Espressione Significato<br />

F1 -nt F2 Il file F1 è più<br />

recente <strong>di</strong> F2 *<br />

F1 -ot F2 Il file F1 è più<br />

vecchio <strong>di</strong> F2 *<br />

${var} Valore <strong>di</strong> var, uguale a $var<br />

F1 -ef F2 I file F1 e F2 sono<br />

degli hard link allo<br />

stesso file *<br />

${var-DEFAULT} Se var non è impostata, valuta l’espressione al<br />

valore <strong>di</strong> $DEFAULT *<br />

${var:-DEFAULT} Se var non è impostata o è vuota, valuta<br />

l’espressione al valore <strong>di</strong> $DEFAULT *<br />

${var=DEFAULT} Se var non è impostata, l’espressione è valutata al<br />

valore <strong>di</strong> $DEFAULT *<br />

${var:=DEFAULT} Se var non è impostata, l’espressione è valutata al<br />

valore <strong>di</strong> $DEFAULT *<br />

${var+ALTRO} Se var è impostata, l’espressione è valutata al<br />

valore <strong>di</strong> $ALTRO, altrimenti a stringa nulla<br />

${var:+ALTRO} Se var è impostata, l’espressione è valutata al<br />

valore <strong>di</strong> $ALTRO, altrimenti a stringa nulla<br />

${var?MSG_ERR} Se var non è impostata, visualizza $MSG_ERR *<br />

763

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

Saved successfully!

Ooh no, something went wrong!