Operating System - HP-UX
1752773 Members
4978 Online
108789 Solutions
New Discussion юеВ

Re: Using command line up arrow/down arrow

 
SOLVED
Go to solution
JohnSeel
Advisor

Using command line up arrow/down arrow

Hello,
I am new to HPUX but have extensive experience on Tru64.

I would like to configure my terminal access to allow use of the up arrow and down arrow for command recall. I have done this in Tru64 by using ksh and setting the editor to emacs (set -o emacs). I use an old terminal emulator called KEA. It can be configured to emulate vt100 or vt400 (7 bit and 9 bit).

So far, I have been unable to get the arrow keys to work properly without actually mapping them via the KEA maps which causes other issues.

I don't like using vi for the command line editor.

Someone recommended installing and using bash instead of ksh, but I would prefer keeping the system shells native to HPUX.

I am running HPUX 11iV3 (B.11.31).

Is there any simple mechanism to configure this? Should I load bash?

Thanks.
16 REPLIES 16
James R. Ferguson
Acclaimed Contributor

Re: Using command line up arrow/down arrow

Hi John:

I think you covered your options: use 'bash' or learn 'vi' at least insofar as using it as a command editor.

Whatever you do, do *not* change the default shell for 'root' from '/sbin/sh' [the POSIX shell in HP parlance]. To do so will lead to an un-startable system. You can temporarily change to the 'bash' shell as root. Simply don't make it the default login shell.

Regards!

...JRF...
JohnSeel
Advisor

Re: Using command line up arrow/down arrow

Thanks, James.

I have already changed the root shell to ksh. Would this also be an issue?

John
James R. Ferguson
Acclaimed Contributor

Re: Using command line up arrow/down arrow

Hi (again) John:

> I have already changed the root shell to ksh. Would this also be an issue?

Yes. The default root login shell as defined in '/etc/passwd' *must* remain '/sbin/sh'. This is a statically linked executable that doesn't use shared libraries found in '/usr'. Thus, during startup, before '/usr' is mounted, a fully functional runtime environment exists. Shells other than '/sbin/sh' live in the '/usr' directory and use shared libraries from that mountpoint.

The HP-UX POSIX shell ('/sbin/sh' for root and '/usr/bin/sh' for non-root users) is really as superset of the Korn (ksh88) shell available as '/usr/bin/ksh'. You should have no problems with the POSIX shell if you are accustomed to using 'ksh'.

A Korn93 version of 'ksh' is available as '/usr/dt/bin/dtksh' if you want the enhancements of Korn93. In 11.31, however, you must have loaded the CDE bundle for this to be available.

Regards!

...JRF...
JohnSeel
Advisor

Re: Using command line up arrow/down arrow

Okay, thanks.
I've changed it back to /sbin/sh.
Thanks for the heads up.
John
James R. Ferguson
Acclaimed Contributor

Re: Using command line up arrow/down arrow

Hi (again) John:

> Okay, thanks.

If you have found the answers you received, helpful, please read:

http://forums.itrc.hp.com/service/forums/helptips.do?#28

Regards!

...JRF...
TwoProc
Honored Contributor

Re: Using command line up arrow/down arrow

John -
I'd go with bash. By default, it does command history via arrow keys. You'll just have to invoke the shell by hand after you log in. No biggie.
We are the people our parents warned us about --Jimmy Buffett
VK2COT
Honored Contributor

Re: Using command line up arrow/down arrow

Hello,

Arrow keys can work in Ksh.

Add into .kshrc

set -o emacs
alias __A='^P'
alias __D='^B'
alias __B='^N'
alias __C='^F'

Where:
^P type as CTRL-V CTRL-C P
^B type as CTRL-V CTRL-C B
...

Some of my students asked me this questions
in the past.

Cheers,

VK2COT
VK2COT - Dusan Baljevic
Steven Schweda
Honored Contributor

Re: Using command line up arrow/down arrow

> [...] You'll just have to invoke the shell
> by hand after you log in. [...]

Or exec the thing from the shell start-up
scriptlet (only) if "/usr" is mounted. As
usual, many things are possible.
Dennis Handly
Acclaimed Contributor

Re: Using command line up arrow/down arrow

>Steven: Or exec the thing from the shell start-up scriptlet (only) if "/usr" is mounted.

This may not be good enough. You should make sure that /usr/local/bin/ (if bash is there) is available and all the shlibs and dld are also available.