You are not logged in.

#1 2007-07-23 15:57:48

geek.arnuld
Member
From: INDIA
Registered: 2007-05-03
Posts: 135
Website

BASH problem

i am running Arch Duke. sometimes i have problem with BASH on it. whenever i type something really long it does not go to the end of the screen, instead the cursor just goes off to the beginning of the line e.g.:

[arnuld@arch ~ $] cp -v songs/rock/Alice_Cooper/* songs/Classic_Rock/Alice_Cooper

if i type that line then in 70% of the cases, the line does not go to the end of the terminal, rather when i reach in the middle of the terminal the cursor there slips off to the very-beginning of the terminal - [arnuld@arch ~$]" - and starts to overwrite things there. when i hit "Enter" then command runs fine but i can't see what command i typed in because the typing starts from the beginning automatically. e.g. it looks like this:

_Cooper@arch ~ $] cp -v songs/rock/Alice_Cooper/* songs/Classic_Rock/Alice

[arnuld@arch ~ $] cp -v songs/rock/Alice_Cooper/* songs/Classic_Rock/Alice_Cooper

compare the two commands. it is because cursor just slipped-off to the beginning and it overwrote the "[arnuld"

this does not happen when my login shell is ZSH. what could be the problem... a BASH bug ?

Offline

#2 2007-07-23 17:00:46

mucknert
Member
From: Berlin // Germany
Registered: 2006-06-27
Posts: 510

Re: BASH problem

I've experienced that problem, too. I'd say that it is indeed a problem of bash. For me, it happens whenever PS1 or PS2 is set to something funky. But I can't really reproduce that all the time. For now, I just do all my bash-work in xfce4-terminal. Does not happen in there for me.


Todays mistakes are tomorrows catastrophes.

Offline

#3 2007-07-23 17:09:27

geek.arnuld
Member
From: INDIA
Registered: 2007-05-03
Posts: 135
Website

Re: BASH problem

mucknert wrote:

I've experienced that problem, too. I'd say that it is indeed a problem of bash. For me, it happens whenever PS1 or PS2 is set to something funky.

yeah, my PS2 is default and PS1 is this: 
PS1="\e[1m\][\e[1;32m\]\u@\h\\e[1;31m\] \W \$\e[0m\]\e[1m\]]\e[0m\] "

mucknert wrote:

But I can't really reproduce that all the time.

i *can* reproduce that most of the times :-(

mucknert wrote:

For now, I just do all my bash-work in xfce4-terminal. Does not happen in there for me.

i no longer use Desktops but i had the same problem in Xfce terminal too. these days i use "wmii"

Offline

#4 2007-07-23 17:14:23

mucknert
Member
From: Berlin // Germany
Registered: 2006-06-27
Posts: 510

Re: BASH problem

Yeah. There you go. Unset your PS1 and see if it keeps happening.


Todays mistakes are tomorrows catastrophes.

Offline

#5 2007-07-23 17:54:16

skymt
Member
Registered: 2006-11-27
Posts: 443

Re: BASH problem

You should surround non-printing characters (color codes, etc) in your prompt string with "\[" and "\]". Otherwise Bash can't calculate how long your prompt is.

Offline

#6 2007-07-23 18:55:32

luca
Member
From: Rome
Registered: 2005-10-30
Posts: 280

Re: BASH problem

Try also with this in your .bashrc:

shopt -s checkwinsize

Offline

#7 2007-07-24 07:25:55

test1000
Member
Registered: 2005-04-03
Posts: 834

Re: BASH problem

this is how the bashfaq in my sig recommends you and how i set my PS1:

BLUE=`tput setf 1`
GREEN=`tput setf 2`
CYAN=`tput setf 3`
RED=`tput setf 4`
MAGENTA=`tput setf 5`
YELLOW=`tput setf 6`
WHITE=`tput setf 7`

PS1='\[$BLUE\]\u \[$YELLOW\]\w\[$CYAN\] \$\[$WHITE\] '

Makes it a bit more readable and understandable.


KISS = "It can scarcely be denied that the supreme goal of all theory is to make the irreducible basic elements as simple and as few as possible without having to surrender the adequate representation of a single datum of experience." - Albert Einstein

Offline

#8 2007-07-24 07:34:56

FUBAR
Member
From: Belgium
Registered: 2004-12-08
Posts: 1,029
Website

Re: BASH problem

I need to get in on this bashfaq thingy. *find back post*


A bus station is where a bus stops.
A train station is where a train stops.
On my desk I have a workstation.

Offline

#9 2007-07-24 07:44:06

geek.arnuld
Member
From: INDIA
Registered: 2007-05-03
Posts: 135
Website

Re: BASH problem

test1000 wrote:

this is how the bashfaq in my sig recommends you and how i set my PS1:

BLUE=`tput setf 1`
GREEN=`tput setf 2`
CYAN=`tput setf 3`
RED=`tput setf 4`
MAGENTA=`tput setf 5`
YELLOW=`tput setf 6`
WHITE=`tput setf 7`

PS1='\[$BLUE\]\u \[$YELLOW\]\w\[$CYAN\] \$\[$WHITE\] '

Makes it a bit more readable and understandable.

great buddy... also thanks for the BASH FAQs :-)

Offline

Board footer

Powered by FluxBB