Is there any way to preserve partial line in bash like zsh? My bash prompt messes up without newline and for printing other non-printable escape characters.
Thanks in advance!
I've tried PS1="\[\e[0m\]\n$PS1"
. But I think that's not a perfect solution. I just want to set my bash prompt to add newline if no EOL detected in previous output.
##~/.local/bin/add_newline
#!/usr/bin/bash
printf "\E[6n";read -sdR CURPOS; CURPOS=${CURPOS#*[}; C="${CURPOS#*;}"
[ "$C" -ne 1 ] && echo
$ chmod +x ~/.local/bin/*
##~/.bashrc
PROMPT_COMMAND="${PROMPT_COMMAND}${PROMPT_COMMAND:+;} add_newline"
Thanks @CharlesDuffy