PS1 in .bashrc
Hello,
I encountered a trifling problem in my .bashrc:
<begin .bashrc>
.....................
.....................
# Define some colors:
RED='\e[1;31m'
cyan='\e[0;36m'
CYAN='\e[1;36m'
YELLOW='\e[1;33m'
NC='\e[0m' # No Color
...................................
...................................
#-------------------------
# Shell prompt:
#-------------------------
LOAD=$(uptime | cut -c 45-49)
TIME=$(date +%H:%M)
PS1="${cyan}[\$TIME \$LOAD]\n${NC}[\u@\h ${YELLOW}\#$NC] \w\$ "
<end .bashrc>
with this PS1 I get:
[18:31 : 0.16]
[user@machineName 1] ~$
but if I write a very long command the cursor remains on the same line and
overlaps the prompt.
If I set PS1 like:
PS1="${cyan}[\$TIME \$LOAD]\n${NC}[\u@\h ${YELLOW}\#$NC] \w\$\n"
the cursor is under the prompt and the new line works correctly if I write
a long command.
Is it possible to have the cursor on the same line of the prompt such that the
long command doesn't overlaps the prompt ?
Thanks in advance for a tip.
--
Gerard
Reply to: