Operating System - HP-UX
1834142 Members
2271 Online
110064 Solutions
New Discussion

Problem using arrow key for History

 
Low Han Ming
Advisor

Problem using arrow key for History

Hi,

I'm having some problem with using arrow key for retrieving history command.

I've the HISTFILE and HISTSIZE defined in my profile and the .sh_history is capture the entry of the history command.
However, whenever I use the arrow key, instead of throwing out the previou command. ^[[A sort of key is shown.

Is there any way that I can specifically use the arrow keys for this purpose?

Thanks.


Han Ming
10 REPLIES 10
Carlo Henrico_1
Regular Advisor

Re: Problem using arrow key for History

Do you have the following:

export EDITOR=vi

Then you can use the vi keys...

EG: Esc [h,j,k,l]

Carlo
Live fast, die young - enjoy a good looking corpse!
John Palmer
Honored Contributor

Re: Problem using arrow key for History

Hi,

The only way that I've managed to do this is to remap the arrow keys in my terminal emulator (Reflections).

h,j,k and l if you use vi mode or
p, n, b and f for emacs mode.

Unfortunately, this means that the arrow keys don't then work in the likes of SAM.

Regards,
John
Ossie de Jongh
Advisor

Re: Problem using arrow key for History

Also will depends what type of terminal/emulation and shell you use.
As far as i know its only bash that support the up/down arrows for command retrieving in normal emulation modes
Manuel Plaza
Regular Advisor

Re: Problem using arrow key for History

Hi,

Why don't use the "bash" shell ?

Regards
Rick Garland
Honored Contributor

Re: Problem using arrow key for History

The arrow key has been there for the bash shell. 'Esc k' has been the HPUX way unless you remap the keys
Pradeep Saxena
Occasional Advisor

Re: Problem using arrow key for History

Hi Han Ming
Alternatively you can also try $ksh -o vi at shell prompt OR define it in /etc/profile or ~/.profile. Use ESC k and J keys to see history of commands issued at shell prompt.
Low Han Ming
Advisor

Re: Problem using arrow key for History

Hi,

Thanks for the reply.

Please kindly correct me if I've misunderstood any of the advice.

I suppose the Esc h,j,k,l can be use for history.
However, even when use the Esc key, immediately when I press on the Esc key the
^[
is shown on screen, doesn't seem like Esc is working too.

Sorry if I have miss out something very basic and obvious.

Thanks.


Han Ming
Pradeep Saxena
Occasional Advisor

Re: Problem using arrow key for History

Hi,
May be problem with TERM type, try with
#export TERM=hp
or
#export TERM=vt100
etc may solve the problem.
Low Han Ming
Advisor

Re: Problem using arrow key for History

Thanks for all the reply.

Maybe I'll try to set the user shell to bash while using sh for admin user.

Thanks again.


Han Ming
Val Syerikov
New Member

Re: Problem using arrow key for History

To make ESC [hjkl] working, try "set -o vi".

Regards
val