-2

When i paste a command in to bash and hit enter, the next lines prompt contains half of the previous issued command. E.G:

host:/Users/user $ some really long command pasted in

-bash: some: command not found

host:/Users/user $ some really command pasFoo

-bash: Foo: command not found

i typed Foo at the next prompt and hit enter. You can see that it only recognized the Foo command so the visual of the previous command is 'not really there'

DWright
  • 9,258
  • 4
  • 36
  • 53
Michael
  • 1,032
  • 2
  • 15
  • 31

2 Answers2

1

Does your prompt contain colors? If so, tell bash what's printable and what isn't, and it should correctly wrap your lines.

that other guy
  • 116,971
  • 11
  • 170
  • 194
  • Here is the prompt construction (with colors) `PS1='\e[35m\h\e[m:\e[1;36m$PWD\e[m\e[1;32m$(__git_ps1)\e[m \$ ';` I'm not sure which characters need to be escaped here as its not simple []'s like in the BashFAQ – Michael Jan 24 '13 at 18:24
  • Yeah, that's the problem. If you put `\[...\]` around all the escape sequences, it'll work: `PS1='\[\e[35m\]\h\[\e[m\]:\[\e[1;36m\]$PWD\[\e[m\e[1;32m\]$(__git_ps1)\[\e[m\] \$ ';` – that other guy Jan 24 '13 at 18:26
0

What kind of terminal are you using? If on Windows with, say Cygwin, or MingW, I've seen this happen when the bash environment variable TERM is not set correctly.

Basically, no matter what kind of terminal you are on, the display interface to the screen (via something like curses or ncurses) is not working perfectly and there may be ways of improving it:

Sometimes, I can improve things by doing export TERM=vt100 (that has even helped me on Linux in a regular terminal window. vt100 is a very old and highly compatible terminal type.

Do an echo $TERM to see what TERM is currently.

DWright
  • 9,258
  • 4
  • 36
  • 53
  • Now that I reread your screen sample, it doesn't look like you are on Windows :-}. Try vt100 anyways. – DWright Jan 24 '13 at 00:21
  • DWright I'm using iTerm on mac OSX. `echo $TERM` `linux` `$ help GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin11)` – Michael Jan 24 '13 at 18:33