DISCLAIMER:
Introduction
By this time it should be already old news that /bin/sh has become the new default shell instead of /bin/csh. But perhaps more subtle is that this new version of Bourne Shell has expanded support for the formatting sequences supported by the
Is it buggy?
I very much appreciate the ability to format the prompt by using a couple of newline
Along this thread I cannot know at large if what particularly happened to me could be in fact general, nor could I state that the workaround would be the best practice or the right thing to do in a similar case. Thus, what I'm trying to share here is to be taken as a mere contribution which may or may not work under other circumstances or scenarios and I shall not be held responsible for anything that could go wrong, that is, if you try what I've successfully did, in part or in its entirety, do at your own risk. Thank you.
Introduction
By this time it should be already old news that /bin/sh has become the new default shell instead of /bin/csh. But perhaps more subtle is that this new version of Bourne Shell has expanded support for the formatting sequences supported by the
PS1
special variable as can be verified on its sh() man page. That's good news, even though I've learned to enjoy the C-Shell as well.Is it buggy?
I very much appreciate the ability to format the prompt by using a couple of newline
\n
characters but unfortunately, at least up to FreeBSD 14.0-RELEASE-p4, this new support seems to have bug or I haven't yet understood how to use it correctly (in the expected way or so). IMHO it feels like a new bug. For instance, a simple sequence such as export PS1="\[\n\e[37;1m\]\h\[\e[0m\]:\[\e[36m\]\w\[\e[0m\] \\$ "
works fine. But if I add a second newline, say, right before \\$
the backspace key start to misbehave. Perhaps better saying, the "bug" seems to generally happen at any other place a newline character is set (even with just a single newline character inserted) except if at the very start of the formatting sequence as I've shown above.