LINUX LITE 7.2 FINAL RELEASED - SEE RELEASE ANNOUNCEMENTS SECTION FOR DETAILS


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do I get long command lines to wrap to the next line?
#4
Oh, sorry mate. I was too tired last night.  Smile
Let's see...
The colors aren't properly escaped.
Variable expansion and the \[ \] escapes around them make them not count as character positions and the cursor position is not wrong.
This is the proper way to do it:
\[\e[1;31m\]foo
or
\[\e[1;31m\]\[$variable\]

If you want to set it up like this
jacatone@Dell-4550:~$ command...
Code:
export PS1="\[\e[1;31m\]\[\u@\h:\w\$\] \[\e[0m\] "
You could also set it in two colors
jacatone@Dell-4550: ~$
Code:
export PS1="\[\e[1;31m\]\[\u@\h\] \[\e[0;32m\]\[\W\$\] \[\e[0m\] "
From your first example I thought you were going to use the [ ] brackets:
[jacatone@Dell-4550~]$
Code:
export PS1="\[\e[1;31m\][\u@\h\w]\$ \[\e[0m\] "
Reply


Messages In This Thread
Re: How do I get long command lines to wrap to the next line? - by misko_2083 - 08-31-2015, 12:45 PM

Forum Jump:


Users browsing this thread: 3 Guest(s)