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.

sq<br />

zip<br />

unzip<br />

unarc<br />

unarj<br />

unrar<br />

file<br />

Capitolo 12. Filtri, programmi e coman<strong>di</strong> esterni<br />

compress per ragioni <strong>di</strong> compatibilità, sebbene gunzip possa decomprimere i file trattati con<br />

compress.<br />

Suggerimento: Il comando znew trasforma i file dal formato compress al formato gzip.<br />

Altra utility <strong>di</strong> compressione. È un filtro che opera solo su elenchi <strong>di</strong> parole ASCII or<strong>di</strong>nate. Usa la<br />

sintassi standard dei filtri, sq < file-input > file-output. Veloce, ma non così efficiente come gzip.<br />

Il corrispondente filtro <strong>di</strong> decompressione è unsq, con la stessa sintassi <strong>di</strong> sq.<br />

Suggerimento: L’output <strong>di</strong> sq può essere collegato per mezzo <strong>di</strong> una pipe a gzip per una<br />

ulteriore compressione.<br />

Utility <strong>di</strong> archiviazione e compressione multipiattaforma, compatibile con il programma DOS<br />

pkzip.exe. Gli archivi “zippati” sembrano rappresentare, su Internet, il mezzo <strong>di</strong> scambio più gra<strong>di</strong>to<br />

rispetto ai “tarball”.<br />

Queste utility Linux consentono <strong>di</strong> decomprimere archivi compressi con i programmi DOS arc.exe,<br />

arj.exe e rar.exe.<br />

Informazioni sui file<br />

Utility per identificare i tipi <strong>di</strong> file. Il comando file nome_file restituisce la specifica <strong>di</strong><br />

nome_file, come ascii text o data. Fa riferimento ai magic number che si trovano in<br />

/usr/share/magic, /etc/magic o /usr/lib/magic, secondo le <strong>di</strong>stribuzioni Linux/UNIX.<br />

L’opzione -f esegue file in modalità batch, per leggere l’elenco dei file contenuto nel file in<strong>di</strong>cato.<br />

L’opzione -z tenta <strong>di</strong> verificare il formato e le caratteristiche dei file compressi.<br />

bash$ file test.tar.gz<br />

test.tar.gz: gzip compressed data, deflated, last mo<strong>di</strong>fied: Sun Sep 16 13:34:51 2001, os: Unix<br />

bash file -z test.tar.gz<br />

test.tar.gz: GNU tar archive (gzip compressed data, deflated, last mo<strong>di</strong>fied: Sun Sep 16 13:34:51 2<br />

278

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

Saved successfully!

Ooh no, something went wrong!