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.

hash [coman<strong>di</strong>]<br />

bind<br />

help<br />

Capitolo 11. Coman<strong>di</strong> interni e builtin<br />

Registra i percorsi assoluti dei coman<strong>di</strong> specificati -- nella tabella degli hash della shell 4 -- in modo<br />

che la shell o lo script non avranno bisogno <strong>di</strong> cercare $PATH nelle successive chiamate <strong>di</strong> quei<br />

coman<strong>di</strong>. Se hash viene eseguito senza argomenti, elenca semplicemente i coman<strong>di</strong> presenti nella<br />

tabella. L’opzione -r cancella la tabella degli hash.<br />

Il builtin bind visualizza o mo<strong>di</strong>fica la configurazione d’uso della tastiera tramite readline 5 .<br />

Fornisce un breve riepilogo dell’utilizzo <strong>di</strong> un builtin <strong>di</strong> shell. È il corrispettivo <strong>di</strong> whatis, per i<br />

builtin.<br />

bash$ help exit<br />

exit: exit [n]<br />

Exit the shell with a status of N. If N is omitted, the exit status<br />

is that of the last command executed.<br />

11.1. Coman<strong>di</strong> <strong>di</strong> controllo dei job<br />

jobs<br />

Alcuni dei seguenti coman<strong>di</strong> <strong>di</strong> controllo <strong>di</strong> job possono avere come argomento un “identificatore <strong>di</strong><br />

job”. Ve<strong>di</strong> la tabella alla fine del capitolo.<br />

Elenca i job in esecuzione in background, fornendo il rispettivo numero. Non è così utile come ps.<br />

Nota: È facilissimo confondere job e processi. Alcuni builtin, quali kill, <strong>di</strong>sown e wait,<br />

accettano come argomento sia il numero <strong>di</strong> job che quello <strong>di</strong> processo. I coman<strong>di</strong> fg, bg e jobs<br />

accettano solo il numero <strong>di</strong> job.<br />

bash$ sleep 100 &<br />

[1] 1384<br />

bash $ jobs<br />

[1]+ Running sleep 100 &<br />

218

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

Saved successfully!

Ooh no, something went wrong!