2011-08-16から1日間の記事一覧

trap - shell sciprt で SIGNAL を trap

perlでは$SIG{INT} あたりにcoderef を設定すればいいけど、bash/zshではどうやるんだろうー。と悩んでman bash を見ていたらtrap という組み込みコマンドを発見。 trap [-lp] [[arg] sigspec ...] The command arg is to be read and executed when the she…