This blog post mentions a neat trick where the shell prints some special output after any command output which doesn't end in a newline. This avoids messing with the prompt, and avoids having to re-run the command with something like ; echo ␄
at the end to see the last line, so I'd like to enable/implement it in my .bashrc. How would I do this?
Asked
Active
Viewed 43 times
0

l0b0
- 51,350
-
1Go zsh; had to chuckle when I saw "In my shell these special backslashes render with reversed colors, so it’s obvious they aren’t part of the output, but my blog is not smart enough to be able to reproduce that." – Jeff Schaller Dec 13 '21 at 02:24
-
1It would be easy enough to reproduce - thankfully, HTML doesn't use ANSI escape codes :D – l0b0 Dec 13 '21 at 02:33
-
If you can't use zsh, you could have your prompt always include a leading new line. – muru Dec 13 '21 at 02:53
-
@muru I do want it to be conditional. – l0b0 Dec 13 '21 at 03:16
-
4Does this answer your question? How to make bash put prompt on a new line after cat command? (though I rather like janos' variant here). – Gordon Davisson Dec 13 '21 at 04:28