2

According to the bash manual (emphasis mine):

PS4
The value is the prompt printed before the command line is echoed when the -x option is set (see The Set Builtin). The first character of PS4 is replicated multiple times, as necessary, to indicate multiple levels of indirection. The default is ‘+ ’.

Is there a way to disable this behavior? I thought of cursor left (\b), but bash seems to only consider the literal first character (\).

1
  • 1
    Make it the null character?
    – DopeGhoti
    Jun 21 '17 at 15:50
4

You can set PS4 to have its first character to be NUL, which takes no space on screen:

export PS4="\000 "

You will then have no visual indication of how deeply-nested the commands in question are.

0

@DopeGhoti's answer did not work for me but this did

PS4='\033[0D'

It moves the cursor 0 characters to the left, so it's basically a NOOP.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.