Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- set -e
- set -o pipefail
- function echoTraps() {
- echo "= on start:"
- trap -p
- trap -- 'echo func-EXIT' EXIT
- echo "= after set new:"
- trap -p
- # we can ensure after script done - file '/tmp/tmp.txt' was not created
- trap -- 'echo SIG 1>/tmp/tmp.txt' SIGPIPE SIGHUP SIGINT SIGQUIT SIGTERM
- }
- trap -- 'echo main-EXIT1' EXIT
- echo "===== subshell trap"
- ( echoTraps; )
- echo "===== pipe trap"
- echoTraps | cat
- echo "===== done everything"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement