Skip to content

Instantly share code, notes, and snippets.

@rrbutani
Created March 6, 2021 19:01
Show Gist options
  • Save rrbutani/4bd197cb50cc0d8266fe6a84cd185e5b to your computer and use it in GitHub Desktop.
Save rrbutani/4bd197cb50cc0d8266fe6a84cd185e5b to your computer and use it in GitHub Desktop.
function instrument {
local state e
state=$(set +o | xargs -L1 echo ' ') # prefix with spaces so these don't pollute the history
set -x
"${@}";
{ e=$?; set +x; } 2>/dev/null
eval "${state}"
return $e
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment