Operating System - HP-UX
1755751 Members
4755 Online
108837 Solutions
New Discussion юеВ

Enabling arrow keys for history recall

 
SOLVED
Go to solution
Subramanian_2
Occasional Advisor

Enabling arrow keys for history recall

Hi,
Can someone help me with enabling arrow keys for history recall? csh or sh implementation wld be preferable.

Thanks in advance.

Regards,
Subu

8 REPLIES 8
G. Vrijhoeven
Honored Contributor

Re: Enabling arrow keys for history recall

Hi Subu,

I would install the bash shell,

http://hpux.connect.org.uk/hppd/hpux/Shells/bash-2.05b.007/

For solutions in sh or csh chech the man pages and take a look at

History Substitutions.

But i think installing bash will be a lot eaier.

Regards,

Gideon
Hoefnix
Honored Contributor

Re: Enabling arrow keys for history recall

Hi,

Bash does the trick but, see also some interesting posts in the next thread:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=605179

HTH,
Peter
Manish Srivastava
Trusted Contributor
Solution

Re: Enabling arrow keys for history recall

Hi,

Try this:

set -o emcas

in ~/.profile, have the

alias __A="^P"

HTH,
Manish
T G Manikandan
Honored Contributor

Re: Enabling arrow keys for history recall

In your sh shell,

export EDITOR=vi
export HISTFILE=~/.sh_history
export HISTSIZE=200

Use Esc+j Esc+k keys to move up and down with the history.

To make them persistent put them into

users .profile file.

If you are only looking for arrow keys just like doskey on windows then go with bash shell.

http://hpux.cs.utah.edu/hppd/hpux/Shells/bash-2.05b.007/

check for the dependencies too!
Tor-Arne Nostdal
Trusted Contributor

Re: Enabling arrow keys for history recall

Hi
Like Manikandan shows you set the editor to be vi (then a history size and a history file).

Remember that you can use vi commands to search through the history with /
And that you can edit the line as well.

We put this into /etc/profile and thus make it global.
If you prefer to have it pr.user you could add it to the current users ~username/.profile and the /etc/skel/.profile for new users.

/Tor-Arne
I'm trying to become President of the state I'm in...
Subramanian_2
Occasional Advisor

Re: Enabling arrow keys for history recall

I tried Manish's reply
"Try this:
set -o emcas
in ~/.profile, have the
alias __A="^P"
"

It gives rise to the following when I tried up and down arrow keys :-
# ^P^P^P^P
sh: ^P^P^P^P: not found.



Bharat Katkar
Honored Contributor

Re: Enabling arrow keys for history recall

Subu,
For history recall we do this and it helps:

# ksh -o vi

Use " k" to scroll.

Regards,
You need to know a lot to actually know how little you know
Muthukumar_5
Honored Contributor

Re: Enabling arrow keys for history recall

Hai,

To enable the history of commands make this /$HOME/.profile as

HISTFILE=/$HOME/.sh_history
HISTSIZE=200
( number of commands to be in history )

It will be activate from next login.
At now change as
# ksh -o vi

We can not scroll the commands with arrow keys as like in linux. We have to use as
[Esc]\ in the command line to get the previous command.

To go to other previous commands user n key, to come again use N

To go the end of command use $ and to the begin use ^

Check the ksh man page for more control options.

Regards,
Muthukumar
Easy to suggest when don't know about the problem!