You are not logged in.

#1 2013-12-11 21:07:06

stamoulohta
Member
From: Stamoulis
Registered: 2013-10-30
Posts: 9
Website

[SOLVED] My terminals (tty and urxvt) fail on multiline commands!

Hi! My computer boots in runlevel 3 and if I start the wm I use the urxvt terminal. In both cases, if a command exceeds the line width, instead of continuing in the next line, it starts rewriting the current one. Even worse are the cases of accessing a large command via the history... then, the printed letters do not correspond to the "actual" ones! So if i need to make a correction, I either have to count the freaking spaces(!!!) or dump it and rewrite the whole command.

in urxvt:

echo $TERM
rxvt-unicode-256color

and in tty:

echo $TERM
linux

Anyone have any ideas?
I thank you in advance!

Last edited by stamoulohta (2013-12-11 22:13:54)


// TODO fix this.

Offline

#2 2013-12-11 21:17:36

dodo3773
Member
Registered: 2011-03-17
Posts: 820

Re: [SOLVED] My terminals (tty and urxvt) fail on multiline commands!

Go into .bashrc or .zshrc and comment out your PS1 or PROMPT entries and see if you still have the problems.

Edit: There is also something called "shopt -s checkwinsize" you can set in .bashrc that may help

Last edited by dodo3773 (2013-12-11 21:22:50)

Offline

#3 2013-12-11 21:42:12

stamoulohta
Member
From: Stamoulis
Registered: 2013-10-30
Posts: 9
Website

Re: [SOLVED] My terminals (tty and urxvt) fail on multiline commands!

Hey dodo3773!
You are right. Disabling the custom prompts in my .bashrc did the trick! But... I really did like my prompts. Was there something wrong in particular with them?
~/.bashrc

PS1='[\u@\h \W]\$ '

/etc/bash.bashrc

function get_prompt {
  eXITSTATUS="$?"
  oFF="\e[0m"
  hOST="\h"
  dIR="\e[1;97m\W${oFF}"

  if [ $UID -eq 0 ]; then 
    uSER="\e[0;31m\u"
    PS2="\e[0;31m-> ${oFF}"
  else
    uSER="\e[0;32m\u"
    PS2="\e[0;32m-> ${oFF}"
  fi

  if [ $eXITSTATUS -gt 0 ]; then
    eXITSTATUS="\e[1;41m:(\e[0;49m "
  else
    eXITSTATUS=""
  fi

  PS1="${eXITSTATUS}${uSER}${oFF}@${hOST} ${dIR} $ "
}

PROMPT_COMMAND=get_prompt
PS3='-> '
PS4='+ '

PS: that "shopt" command doesn't have a man page and/or a --help switch... Let's see what happens!!
Edit: nope, it doesn't make any noticeable difference.

Last edited by stamoulohta (2013-12-11 21:48:45)


// TODO fix this.

Offline

#4 2013-12-11 21:48:18

dodo3773
Member
Registered: 2011-03-17
Posts: 820

Re: [SOLVED] My terminals (tty and urxvt) fail on multiline commands!

Maybe this helps:

http://stackoverflow.com/questions/1977 … tom-prompt

Maybe something is not getting escaped correctly.

Offline

#5 2013-12-11 22:00:56

2ManyDogs
Forum Fellow
Registered: 2012-01-15
Posts: 4,646

Re: [SOLVED] My terminals (tty and urxvt) fail on multiline commands!

dodo3773 wrote:

Maybe this helps:

http://stackoverflow.com/questions/1977 … tom-prompt

Maybe something is not getting escaped correctly.

Yes. Also see this topic: https://bbs.archlinux.org/viewtopic.php … 4#p1357714

Last edited by 2ManyDogs (2013-12-11 22:01:48)

Offline

#6 2013-12-11 22:04:15

stamoulohta
Member
From: Stamoulis
Registered: 2013-10-30
Posts: 9
Website

Re: [SOLVED] My terminals (tty and urxvt) fail on multiline commands!

That's it!
Thank you for your help guys! Cheers!

Last edited by stamoulohta (2013-12-11 22:06:09)


// TODO fix this.

Offline

#7 2013-12-11 22:06:28

dodo3773
Member
Registered: 2011-03-17
Posts: 820

Re: [SOLVED] My terminals (tty and urxvt) fail on multiline commands!

You are welcome. Happy to help.

Sidenote: If you are in a shell a lot you may want to give zsh a spin to see if you like it.

Offline

Board footer

Powered by FluxBB