少し前にオライリーの入門Bashを読んで、このデバッグ方法を知って「おおー」と感動をしたので、この喜びを書いてみました。 sh系には trap というコマンドでシグナルトラップができて便利ですが、bash にはさらに便利な疑似シグナルというものがあったりします。bashのmanpagerをみると、trapのsigspecをERRとした場合、コマンドが0以外でexitした場合にトラップしてくれるようです。 If a sigspec is ERR, the command arg is executed whenever a simple command has a non-zero exit status, subject to the following conditions. The ERR trap is not executed if the failed command is pa
![Bashの擬似シグナルを使ったデバッグ方法 - harry’s memorandum](https://cdn-ak-scissors.b.st-hatena.com/image/square/07d9e16f458c0d80878de55f75790d0add05f22a/height=288;version=1;width=512/http%3A%2F%2Fecx.images-amazon.com%2Fimages%2FI%2F519CHDKSHWL.jpg)