You are not logged in.

#1 2010-01-06 13:18:46

slot
Member
Registered: 2008-09-08
Posts: 65

bash multiline commands does not wrap nicely [Solved]

In my Archlinux, using commands longer than 1 line makes bash rewrite on the same line, makes it impossible to read and use.
What have I forgot?

Also when using history it becomes completely unreadable, and the cursor jumps around the line, and the first four characters of the previous line stays on. hmm

Last edited by slot (2010-01-14 17:25:55)

Offline

#2 2010-01-06 14:07:45

the_isz
Member
Registered: 2009-04-14
Posts: 280

Re: bash multiline commands does not wrap nicely [Solved]

I have encountered this behaviour as well but always thought it might be a
problem of my terminal, screen or some settings I have in .bashrc.

Let's try to see where our setups differ:

* What terminal (emulator) are you using?
* Do you use screen?
* Have you made changes to your .bashrc or your /etc/profile?

I'm using rxvt-unicode with screen and a custom .bashrc.

Offline

#3 2010-01-06 15:32:38

JuseBox
Member
Registered: 2009-11-27
Posts: 260

Re: bash multiline commands does not wrap nicely [Solved]

putting:

export TERM=linux

works for me.  in my .bashrc


Linux ArchLinux 3.2.8-1-ARCH
#1 SMP PREEMPT Mon Feb 27 21:51:46 CET 2012 x86_64 AMD FX(tm)-8120 Eight-Core Processor AuthenticAMD GNU/Linux
8192MB DDR3 1300MHz | Asus m5a97 | GeForce GTX 550 Ti | 120 GB SSD

Offline

#4 2010-01-07 06:40:40

the_isz
Member
Registered: 2009-04-14
Posts: 280

Re: bash multiline commands does not wrap nicely [Solved]

JuseBox wrote:

putting:

export TERM=linux

works for me.  in my .bashrc

I'll try that once I encounter the problem again (for me, it doesn't always
occur).

Offline

#5 2010-01-07 11:11:24

slot
Member
Registered: 2008-09-08
Posts: 65

Re: bash multiline commands does not wrap nicely [Solved]

the_isz wrote:

I have encountered this behaviour as well but always thought it might be a
problem of my terminal, screen or some settings I have in .bashrc.

Let's try to see where our setups differ:

* What terminal (emulator) are you using?
* Do you use screen?
* Have you made changes to your .bashrc or your /etc/profile?

I'm using rxvt-unicode with screen and a custom .bashrc.

Konsole,

Screen no

Yes:

alias ls='ls --color=auto'
PS1='[\u@\h \W]\$ '
export OOO_FORCE_DESKTOP=gnome
source /usr/share/cdargs/cdargs-bash.sh

Offline

#6 2010-01-07 11:19:04

slot
Member
Registered: 2008-09-08
Posts: 65

Re: bash multiline commands does not wrap nicely [Solved]

JuseBox wrote:

putting:

export TERM=linux

works for me.  in my .bashrc

It seems to help here too smile

Offline

#7 2010-01-08 17:58:06

JuseBox
Member
Registered: 2009-11-27
Posts: 260

Re: bash multiline commands does not wrap nicely [Solved]

slot wrote:
JuseBox wrote:

putting:

export TERM=linux

works for me.  in my .bashrc

It seems to help here too smile

Awesome!


Linux ArchLinux 3.2.8-1-ARCH
#1 SMP PREEMPT Mon Feb 27 21:51:46 CET 2012 x86_64 AMD FX(tm)-8120 Eight-Core Processor AuthenticAMD GNU/Linux
8192MB DDR3 1300MHz | Asus m5a97 | GeForce GTX 550 Ti | 120 GB SSD

Offline

#8 2010-02-09 23:59:12

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: bash multiline commands does not wrap nicely [Solved]

Using TERM=linux isn't the proper fix here. The cause is that the terminal is incorrectly configured. All this has done is misconfigure it another way so that things look better.

The "rewritting on the same line" issue is related to terminfo. terminfo is basically a big old database of commands that programs use to tell the terminal to do different things. For instance, a program can say "ok terminal, switch the color to green" and it does it. If you've played with any PS1 related things, you've seen some of these: the color escapes. For all of them that your terminal supports, try running "infocmp".

Why am I telling you this? Because the application (bash) is sending the wrong escape to your terminal, or possibly no escape at all. This could happen for two reasons:

a) Your TERM setting is set to a value that is NOT your terminal. Don't do this. Ever. Lots of people seem to suggest setting it to xterm-color and goofy things in various config files, but this is wrong wrong wrong. TERM shouldn't be set manually except in some corner cases[1].

b) Your COLUMNS setting is out of whack. This can happen when the terminal doesn't properly adjust the running environment when you resize it (by sending SIGWINCH signals). In this case, "shopt -s checkwinsize" (bash only) may fix this for you. This tells bash to recheck $LINES and $COLUMNS after each command.

1: TERM can safely be set to any terminfo the terminal supports. The xterm in the repos supports xterm-256color, xterm-16color, xterm-color, and xterm, to name a few. It is common to need to downgrade this if connecting to older Unix systems. For instance, I have a .bashrc on an older solaris machine at work that exports TERM=xterm, as it doesn't have terminfo for any xterm-*color terminals.

Offline

Board footer

Powered by FluxBB