Hello, I wish I could use PS4 to colorize debugging lines, like: PS4='\033[37m+ ' But I need to reset the color at the end of the line. I wish there were a similar variable to be able to reset the ansi code at the end of the line, like PS4_AFTER='\033[0m+'
Do you know a hack to reset color at the end of each debug line ? FYI, my current hack is: # in bashrc: export PS4='+\302\240' alias shdebugpipe='sed -e "s/^+\o302\o240.*/\x1b[37m\0\x1b[0m/"' # then invoke script with: bash -x ./foo.sh 2>&1 | shdebugpipe (I replaced the regular space with a non-breakable space[1] in PS4 to avoid highlighting script output. The one I am using is little bit more complex. it uses BOM[2] instead of NBSP): # in bashrc: export PS4='\357\273\277#$LINENO:' alias shdebugpipe='sed -e "s/^\o357\o273\o277.*/\x1b[37m\0\x1b[0m/"' Franklin (Please CC me, I am not subscribed to this list). [1] NBSP: http://en.wikipedia.org/wiki/Non-breaking_space [2] BOM: http://en.wikipedia.org/wiki/Byte_order_mark