trick to make bash tasks easier to debug

Post author
Andrew Davidson

FYI

Here is a trick so that you can use `set -x`. to create bash script trace of the execution. this can be handy for debugging.  You will see the command and the output in a single file. 

enjoy, share

Andy

 

# see bash man page "SHELL BUILTIN COMMANDS" for details
# we do not control the execution of this workflow
# cromwell/docker ? puts set -x in stderr. this makes debugging harder
# https://ops.tips/gists/redirect-all-outputs-of-a-bash-script-to-a-file/#using-exec-to-redirect-\
stdout-and-stderr
# Redirect standard error to standard out such that
# standard error ends up going to wherever standard
# out goes (the file).
exec 2>&1

set -x # turn debug tracing on

Comments

0 comments

Please sign in to leave a comment.