Bash wraps long lines in the same line

http://thread.gmane.org/gmane.linux.gentoo.user/56979:

From: Thomas Achtemichuk  tomchuk.com>
 Subject: Re: anoying terminal
 Newsgroups: gmane.linux.gentoo.user
 Date: Thu, 04 Dec 2003 13:49:19 +0000
 
On 12/04/03 11:05:43, Helder Rossa wrote:
> my terminal in gnome when I'm writing a command bigger than the console
> size it wraps the text to the same line that i was witting on :-S .

By default bash doesn't check it's window size after every command. The  
good thing is that you can make it. Add "shopt -s checkwinsize" to your
~/.bashrc or /etc/profile. Works like a charm.

To reproduce the "error":
man bash
resize the window
quit, and type a long string at the prompt.

It will wrap at the window's original width and wrap onto the same line.
echo "shopt -s checkwinsize" >> ~/.bashrc (or /etc/profile)
source ~/.bashrc
try again

It works correctly!

In my opinion this is something (along with a decent PS1) that should be  
added to the default /etc/profile or /etc/skel/.bashrc and the user should  
never have to set by themselves.

-- 
Thanks,
Thomas Achtemichuk

Leave a Reply

Your email address will not be published. Required fields are marked *