Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash -x
- function i_know_what_this_does() {
- (
- set +x
- echo do stuff
- )
- }
- echo the next-next line still echoes 'set +x', is that avoidable?
- i_know_what_this_does
- echo and we are back and echoing is back on
- + echo the next-next line still echoes 'set +x,' is that 'avoidable?'
- the next-next line still echoes set +x, is that avoidable?
- + i_know_what_this_does
- + set +x
- do stuff
- + echo and we are back and echoing is back on
- and we are back and echoing is back on
- ikwtd() {
- echo do stuff
- } 2> /dev/null
- ikwtd() (
- set +x
- exec 2>&3 3>&-
- echo do stuff
- ) 3>&2 2> /dev/null
- function xtrace() {
- # Print the line as if xtrace was turned on, using perl to filter out
- # the extra colon character and the following "set +x" line.
- (
- set -x
- # Colon is a no-op in bash, so nothing will execute.
- : "$@"
- set +x
- ) 2>&1 | perl -ne 's/^[+] :/+/ and print' 1>&2
- # Execute the original line unmolested
- "$@"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement