In zsh, if a command lacks a trailing newline (like echo -n hello
), an inverted percent sign with a newline is appended to the output so the prompt can be printed on its own line, not directly after the output. The bashrc in this example will emulate this behavior in bash.
dave @ [ manilla :: (Darwin) ] ~ $ echo hello
hello
dave @ [ manilla :: (Darwin) ] ~ $ echo -n hello
hellodave @ [ manilla :: (Darwin) ] ~ $
dave @ [ manilla :: (Darwin) ] ~ $ echo hello
hello
dave @ [ manilla :: (Darwin) ] ~ $ echo -n hello
hello%
dave @ [ manilla :: (Darwin) ] ~ $
This has an issue, if you start typing in a command before the last command has finished, anything typed will be lost.
ie. run
sleep 3
, and as it's running typels<enter>
. normally, once the sleep has finishedls
will be executed, but with this in place, the textls<enter>
will be lost.