Is it possible to test whether a bash script was executed with -x?I'm writing a script which also runs some remote scripts, and I'd like to be able to do something like:USE_X=$( run_with_x && -x ||  )ssh $host bash $USE_X some_script.sh
Bash: test whether original script was run with `-x`
bash
Just look at the $- variable.USE_X=`case $- in *x*) echo -x ;; esac`(Yup, I did manage to do that without invoking grep.  Save the pids!)