We all know this annoying issue:
$ printf "abc" > some-file
$ cat some-file
abc$
which tends to mess up the prompt if it is any more complex than $
, throws off the current cursor position and looks just plain ugly. There are some solutions (e.g. here), but they have another drawback: Logging into a slow machine over ssh, you may start to type before the prompt appears. Normally, your input is then buffered and displayed nicely as soon as possible. However, with the linked solution, the input is discarded.
How do I
- always start the prompt on a new line, esp. if the output of the last command did not end with a new line and
- keep unconsumed input already entered during the execution of the previous command in the command line buffer?