Can I make "bash -x" not print the "+ " prefix?

165 views Asked by At

When I invoke bash with the -x option, it prints each command before it is executed. However - the commands are printed with a "+ " prefix.

Is there a way to get it to print the commands, but without this prefix? With -x or without it?

2

There are 2 answers

0
Lasse Meyer On BEST ANSWER

You can customize the prefix when using bash -x by setting the variable PS4. So in your .bashrc, you could have something like this:

export PS4=''

Or, if you want to debug something, let it print the line number like this:

export PS4='[ $LINENO ] '
2
Oliver Gaida On

Insert as the first line :

set -v

then run it without -x