In GNU Screen, Recalled bash history command displays one character position to the left of actual location
Posted
by
vergueishon
on Super User
See other posts from Super User
or by vergueishon
Published on 2011-01-26T18:02:03Z
Indexed on
2011/02/15
23:28 UTC
Read the original article
Hit count: 413
I am running Red Hat 5 32-bit (2.6.18-194.26.1.el5).
The issue is that when I recall any previous command in bash's history, the first character in the command is displayed immediately after the shell prompt, without any intervening space, likeso:
\[me@mymachine tmp]$man mysql
If I enter a Ctrl-C, and retype the command, it looks likeso:
\[me@mymachine tmp]$ man mysql
This makes recalling a command and editing it before re-entering a real pain. Basically, if I try to edit a recalled command, my changes occur one character position to the left (I believe) of what I see on the screen. It's a bit tedious to describe, and appears to only happen with commands with a large number of arguments.
UPDATE: The contents of /etc/sysconfig/bash-prompt-screen,
1 #!/bin/bash
2 echo -n $'\033'"_${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}"$'\033\\\\'
and the contents of /etc/bashrc,
24 screen)
25 if [ -e /etc/sysconfig/bash-prompt-screen ]; then
26 PROMPT_COMMAND=/etc/sysconfig/bash-prompt-screen
27 else
28 PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}"; echo -ne "\033\\"'
29 fi
30 ;;
I've disable bash-prompt-screen by renaming it--this fixed it. It's entirely possible that there is a fix to the bash-prompt-screen prompt line in the latest version of screen for RHEL 5. The error is seen under Screen version 4.00.03 (FAU) 23-Oct-06. (I noticed an update in the queue, which is installing as I write this.)
© Super User or respective owner