以下の内容はhttps://hogem.hatenablog.com/entry/20110816/1313506764より取得しました。


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 shell receives signal(s) sigspec.
$ trap date 2 

とすると、Ctrl-C を押してSIGINTを送るとdateコマンドが実行される。




以上の内容はhttps://hogem.hatenablog.com/entry/20110816/1313506764より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14