How do I get long command lines to wrap to the next line? - Printable Version +- Linux Lite Forums (https://www.freecinema2022.gq/forums) +-- Forum: Development (https://www.freecinema2022.gq/forums/forumdisplay.php?fid=7) +--- Forum: Scripting and Bash (https://www.freecinema2022.gq/forums/forumdisplay.php?fid=32) +--- Thread: How do I get long command lines to wrap to the next line? (/showthread.php?tid=2134) |
How do I get long command lines to wrap to the next line? - jacatone - 08-30-2015 I'm using color in my bash shell but can't get the text to drop to the next line below. Could someone tell me what's wrong here? export PS1="\[\e[1;31m[\u@\h \W]\$ \e[m " Re: How do I get long command lines to wrap to the next line? - anon222 - 08-30-2015 (08-30-2015, 08:13 AM)jacatone link Wrote: I'm using color in my bash shell but can't get the text to drop to the next line below. Could someone tell me what's wrong here?If you want to move the prompt sse the \n switch at the end Code: export PS1="\e[1;31m[\u@\h \W]\$ \e[m \n" Re: How do I get long command lines to wrap to the next line? - jacatone - 08-31-2015 Actually, I meant after the $ sign then drop down below to the next line like it would if I didn't add any color. jacatone@Dell-4550:~$ 64dfg646df4g654fg654d6fg64fd64g6fd4g64fd64g6df4g6fd 5g64fd64g665df4g646sd465464ds646d5f4 Re: How do I get long command lines to wrap to the next line? - anon222 - 08-31-2015 Oh, sorry mate. I was too tired last night. 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\] " jacatone@Dell-4550: ~$ Code: export PS1="\[\e[1;31m\]\[\u@\h\] \[\e[0;32m\]\[\W\$\] \[\e[0m\] " [jacatone@Dell-4550~]$ Code: export PS1="\[\e[1;31m\][\u@\h\w]\$ \[\e[0m\] " Re: How do I get long command lines to wrap to the next line? - jacatone - 08-31-2015 Ah, it's getting there. It now types over anything added to the second drop down line rather than just continuing on. jacatone@Dell-4550 ~$ 54df5dddddddddddddddddddddddddddddddddddddddddddddddddddd 222222dddddddddddddd should be, jacatone@Dell-4550 ~$ 54df5dddddddddddddddddddddddddddddddddddddddddddddddddddd dddddddddddddd222222 Re: How do I get long command lines to wrap to the next line? - shengchieh - 09-05-2015 For references go to http://shengchieh.50webs.com/tuxslinks.html#Console%20Commands Look at scripts??? Sheng-Chieh |