Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
bash is my default shell. When I type a long command line in a terminal, it does not wrap to the next line when I reach the end of the line... instead it wraps onto the same line, overwriting my prompt and the resf of what I typed. The commands still work, but it's obviously very inconvenient not to be able to correctly see what you are typing.
If I switch to sh as my shell instead (by typeing sh), the command lines wrap correctly. But I don't want to use sh.
If I switch the TERM environmental variable from xterm to vt100, the command lines wrap correctly. But this causes problems with other applications, notably vim.
The problem occurs in all the graphical terminals (xterm, konsole, gnome-terminal, rxvt, etc), though not when I am not using X (and TERM is set to vt100).
Can anyone tell me how to get the bash shell to wrap long lines to the next line correctly? It may be a matter of setting TERM to something other than xterm, but I am not very familar with terminfo and how all that works.
Thanks so much for any help you can provide!!
My system:
RedHat 9.0
bash-2.05b-20.1
/etc/termcap Version 10.2.1
I'm a little confused. I gather you aren't talking about the monitor but other boxes running an x-terminal emulator like MI/X? Or are you saying this happens when you open a terminal screen on the monitor?
Originally posted by gernt I'm a little confused. I gather you aren't talking about the monitor but other boxes running an x-terminal emulator like MI/X? Or are you saying this happens when you open a terminal screen on the monitor?
I'm not familiar with MI/X, but let me clarify the problem.
When I type a long command line at the command prompt within an xterm, it should wrap to the next line, like this:
[my prompt]$ ls -l file1 file2 file3 file4 file5 file6 file7 fi
le8 file9
Instead, what happens is this:
le8 file9]$ ls -l file1 file2 file3 file4 file5 file6 file7 fi
See? Instead of wrapping to the next line, the part of the command that exceeds the length of the line starts from the begining of the CURRENT line, overwriting the prompt and what I've typed.
It only happens in xterminals of various types, logged into my local computer (from programs like xterm, rxvt, konsole, gnome-terminal, etc.) . It does not happen on the console before I start xwindows.
Please let me know how to fix this problem if you know. Thank you.
OK, I gather you have xterminals and not Windows computers emulating xterminals. That was my question. I haven't seen a regular xterminal in some time. I tried, but I could not replicate it. But I don't have a vanilla xterminal. I've certainly seen the problem when scrolling is not set right on one end or another. Did it ever work - say on a prior revision? Or is this a brand new setup.
unfortuately I had been setting the color values incorrectly (the values above are the correct ones). I had not been terminating the sequences of non-printing characters correctly, and I believe this is what caused the line wrapping to fail.
I got so balled up in trying to keep all the initial scripts together, I moved them to /usr/local/etc. The .bash_motd, .bashrc, etc. in the users area just call the ones in /usr/local/etc. Then, if I make a change, everybody gets changed.
You're correct, terminating the sequence is what causes the lines to wrap incorrectly. I had this same problem on my box, and spent 5 hours or so last nite researching it until I found http://www-106.ibm.com/developerwork.../l-tip-prompt/ .A very good tutorial on the setting your prompt to different colors, written by the creator of gentoo.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.