Does anyone know if we can say set +x in bash without it being printed:
set +x
set -x command set +x
traces
+ command
How about a solution based on a simplified version of @user108471:
shopt -s expand_aliases alias trace_on='set -x' alias trace_off='{ set +x; } 2>/dev/null' trace_on ...stuff... trace_off