You are not logged in.

#1 2009-10-20 17:40:34

Fazir
Member
Registered: 2009-10-20
Posts: 2

[SOLVED] Long comand line input

Hello. I have problem with my gnome-terminal. When the command line is too long, it rolls to the same row instead of the next one.

Here you can see it if my explanation isn't clear enough:

Terminal.jpg

I don't remember since when I have this problem, but I have modified my .bashrc file some time ago. Maybe this is the reason. Its content:

# Check for an interactive session
[ -z "$PS1" ] && return

complete -cf sudo
alias sudo="sudo -E"

alias ls='ls --color=auto'
PS1="\e[1;34m\u@\h \W> \e[m"

I would appreciate any hint how to fix it smile

Last edited by Fazir (2009-11-05 17:03:18)

Offline

#2 2009-10-20 19:35:25

Gen2ly
Member
From: Sevierville, TN
Registered: 2009-03-06
Posts: 1,529
Website

Re: [SOLVED] Long comand line input

Using checkwinsize might fix it:

shopt -s checkwinsize

Setting Up a Scripting Environment | Proud donor to wikipedia - link

Offline

#3 2009-10-20 19:51:05

brisbin33
Member
From: boston, ma
Registered: 2008-07-24
Posts: 1,796
Website

Re: [SOLVED] Long comand line input

with PS1 you have to wrap any non printing characters \[ like this \]:

PS1="\[\e[1;34m\]\u@\h \W> \[\e[m\]"

Offline

#4 2009-10-21 16:34:42

quarkup
Member
From: Portugal
Registered: 2008-09-07
Posts: 497
Website

Re: [SOLVED] Long comand line input

yup. you need to wrap all non-printing characters with \[ and use also \e for the colors

good luck


If people do not believe that mathematics is simple, it is only because they do not realize how complicated life is.
Simplicity is the ultimate sophistication.

Offline

#5 2009-10-21 17:50:24

takedown
Member
From: Argentina
Registered: 2008-08-31
Posts: 219

Re: [SOLVED] Long comand line input

I have the same issue, here a part of my .bashrc

PS1='\e[0;36m::\e[1;33m\u:\e[0;36m\w \e[1;33m\$ \e[0;37m\]'

Offline

#6 2009-10-21 17:56:49

brisbin33
Member
From: boston, ma
Registered: 2008-07-24
Posts: 1,796
Website

Re: [SOLVED] Long comand line input

dude, read my first post.

Offline

#7 2009-10-21 18:03:55

Gen2ly
Member
From: Sevierville, TN
Registered: 2009-03-06
Posts: 1,529
Website

Re: [SOLVED] Long comand line input

Or lookup bash on the wiki.


Setting Up a Scripting Environment | Proud donor to wikipedia - link

Offline

#8 2009-10-21 18:10:22

takedown
Member
From: Argentina
Registered: 2008-08-31
Posts: 219

Re: [SOLVED] Long comand line input

brisbin33 wrote:

dude, read my first post.

You are the man! So so sorry, but my english is very very poor, but with a little effort, now it worked.

PS1='\[\e[0;36m\]::\[\e[1;33m\]\u:\[\e[0;36m\]\w \[\e[1;33m\]\$ \[\e[0;37m\]'

Thanks again

Offline

#9 2009-10-21 21:16:31

Fazir
Member
Registered: 2009-10-20
Posts: 2

Re: [SOLVED] Long comand line input

Fixing PS1 worked! Thank you brisbin33 smile

Offline

#10 2009-10-21 21:30:08

brisbin33
Member
From: boston, ma
Registered: 2008-07-24
Posts: 1,796
Website

Re: [SOLVED] Long comand line input

yw smile

please be sure to edit the original post and add [SOLVED] to the title.

Offline

Board footer

Powered by FluxBB