0

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?

l0b0
  • 50,672
  • 41
  • 197
  • 360
  • 1
    Go 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
  • 1
    It 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
  • 4
    Does this answer your question? [How to make bash put prompt on a new line after cat command?](https://unix.stackexchange.com/questions/60459/how-to-make-bash-put-prompt-on-a-new-line-after-cat-command) (though I rather like janos' variant [here](https://stackoverflow.com/questions/19943482/configure-shell-to-always-print-prompt-on-new-line-like-zsh/20152662#20152662)). – Gordon Davisson Dec 13 '21 at 04:28

0 Answers0