Many of our customers run our software on HP-UX. I had a call from one such customer recently and I had to reproduce the problem on in-house HP-UX.
I chose to use a new HP-UX machine on remote location. After a few days, I noticed
bash behaves a little differently. When I type in long command line, it scrolls the line to the left making head of the line invisible. This is not desirable because it makes copy&paste impossible. So, I started investigating.
First thing I found is that this feature is called 'horizontal-scroll-mode'.
$ man bash 2>/dev/null | ggrep -A 2 scroll
horizontal-scroll-mode (Off)
When set to On, makes readline use a single line for
display, scrolling the input horizontally on a single
screen line when it becomes longer than the screen
width rather than wrapping to a new line.So, I flipped the setting but it made no difference. It was set to 'off' to begin with, anyway.
$ bind -v | grep scroll
set horizontal-scroll-mode off
$ bind 'set horizontal-scroll-mode on'
$ bind -v | grep scroll
set horizontal-scroll-mode on
$ bind 'set horizontal-scroll-mode off'
$ bind -v | grep scroll
set horizontal-scroll-mode off
$
<a pretty long command line. This is a pretty long command line. This is a pretty long command line.
So, I googled and found that this is related to termcap/terminfo setting. On HP-UX, this capability seems to be called 'cuu1'.
$ man terminfo 2>/dev/null | grep cuu1
cursor_up cuu1 up Upline (cursor up)
It is defined in terminfo and for current session. It works, too.
$ echo $TERM
xterm
$ untic | grep -w cuu1
cnorm=\E[?25h, cuf1=\E[C, cuu1=\E[A, cvvis=\E[?25h,
$ tput cuu1 | more
^[[A
In desperation, I logged on older HP-UX machine and checked. It worked! I compared '
untic' output but there's no difference.
So, I started to suspect bash bug and checked version on both machines.
- older HP-UX
$ bash --version
GNU bash, version 3.2.0(2)-release (hppa2.0w-hp-hpux11.11)
Copyright (C) 2005 Free Software Foundation, Inc.
- newer HP-UX
$ bash --version
GNU bash, version 3.00.16(1)-release (hppa2.0w-hp-hpux11.23)
Copyright (C) 2004 Free Software Foundation, Inc.
Yeah, this was it. Newer HP-UX had older version bash. Probably, bash 3.0 had HP-UX specific bug. I can now copy&paste happily, as I did in this entry. :)