On Mon, 6 Apr 2009 14:55:12 +1000 Chris <atst...@gmail.com> wrote: > On Thu, Apr 2, 2009 at 3:00 PM, Nick Guenther <kou...@gmail.com> > wrote: > > On Thu, Apr 2, 2009 at 12:58 AM, Chris <atst...@gmail.com> wrote: > >> On Thu, Apr 2, 2009 at 3:55 PM, Nick Guenther <kou...@gmail.com> > >> wrote: > >>> On Thu, Apr 2, 2009 at 12:52 AM, Chris <atst...@gmail.com> wrote: > >>>> On Thu, Apr 2, 2009 at 3:46 PM, Nick Guenther <kou...@gmail.com> > >>>> wrote: > >>>>> On Thu, Apr 2, 2009 at 12:37 AM, Chris <atst...@gmail.com> > >>>>> wrote: > >>>>>> I am trying to get the shell history with page-up but looks > >>>>>> like it's not working. I'm running -current with the default > >>>>>> ksh and added HISTSIZE=50 and export HISTSIZE to ~/.profile. > >>>>>> > >>>>>> Does anyone know how to get it? > >>>>> > >>>>> I've never seen it not work. Does it work for you on -RELEASE? > >>>>> Does it work if you don't set HISTSIZE at all? > >>>> > >>>> No, it doesn't work either way. Maybe I should mention that it's > >>>> only a test machine so I didn't create a swap partition (it has > >>>> only one 6 GB / partition) - could this be the reason why? > >>>> > >>>> Thanks. > >>> > >>> > >>> I doubt it but I don't know the code off by heart. A more likely > >>> reason is your terminal settings, what's $TERM? > >> > >> You are right: it's something to do with the $TERM environment > >> variable. I ssh to the box from inside GNU screen so $TERM shows > >> screen; OTOH, if I log on to the box directly, $TERM shows vt220. > >> > >> Should I export term vt220 in .profile? > >> > > > > Oh you're using screen? Does the problem show up when you don't use > > screen? > > Yes, it does. I am ssh'ing to the OpenBSD box using Xterminal emulator > that comes with XFCE. When I log in, it shows terminal as xterm and > Page up don't work. If I change the terminal to vt220 (export > TERM=vt220 && echo $TERM), it shows vt220 but page up still doesn't > work. The only time page up works is when I log on via the physical > console. >
In short, there is *no* default mapping in ksh for PageUp and PageDown. Surprisingly enough, your shell history, and how it is accessed, depends, for the most part, on the shell you are using. If you look at your configuration files for the C shell, ~/.login and ~/.chsrc, in the first you'll find 'savehist' and in the second you'll find the 'h' alias for accessing the shell history. The default shell on OpenBSD is no longer the C Shell, but instead is a variant of the Korn Shell (ksh). If you take the time to read the man page for ksh, you'll find that 'history' is just a *default* alias for the `fc -l` command. Your main problem is mistaken perception; you are expecting UNIX to behave like GNU crap (bash/screen/whatever). If you are running the default system shell, namely ksh(1), you can access the history, line by line, in two different ways: 1.) The Up-Arrow and Down-Arrow keys 2.) The CTRL-P (Previous, also known as "up-history") and CTRL-N (Next, also known as "down-history") key combinations. The ksh(1) man page even details the exact default key bindings used to make the Up and Down Arrow keys access the shell history. If you are using ksh, and the above keys/key-combos do not work, then you have screwed around with the default ksh settings, or you are using a garbage terminal emulator that is screwing with the key-bindings. The terminal emulator in XFCE is stupidly named "Terminal" and like all terminal emulators, has it's own set of quirks, conflicts and limitations. The "GNU screen" program is terminal multiplexer and has countless quirks, conflicts and bugs, in addition to a virus license. Unless you are using the default xterm(1), without modification, it's nearly impossible to tell what kind of remapping/rebinding your terminal emulator is doing, assuming it's doing any rebinding/remapping. None the less, in ksh you can set your own bindings. To get a list of existing bindings, just run the `bind` command without arguments. # UpArrow - up-history - works (default) # ^XA = up-history $ bind '^[[A'=up-history # DownArrow - down-history - works (default) # ^XB = down-history $ bind '^[[B'=down-history # RightArrow - forward-char - works (default) # ^XC = forward-char $ bind '^[[C'=forward-char # LeftArrow - backward-char - works (default) # ^XD = backward-char $ bind '^[[D'=backward-char These two are useful additions: # End Key - Goto Last Character In Line - works # ^XF = end-of-line $ bind '^[[F'=end-of-line # Home Key - Goto First Character In Line - works # ^XH = beginning-of-line $ bind '^[[H'=beginning-of-line Unfortunately, I've got no clue what the correct eXtra-key binding is for the PageUp and PageDown keys. I thought they were either ^XI and ^XG, or ^XJ and ^XK, but both of those combinations are wrong. # PageUp Key - broken # ^XI = up-history # ^XJ = up-history $ bind '^[[I'=up-history # PageDown Key - broken # ^XG = down-history # ^XK = down-history $ bind '^[[G'=down-history If you spend enough time digging through termcap/terminfo you'll probably figure out the correct magic for PgUp and PgDn. -- J.C. Roberts