HPE Community read-only access December 15, 2018
This is a maintenance upgrade. You will be able to read articles and posts, but not post or reply.
Hours:
Dec 15, 4:00 am to 10:00 am UTC
Dec 14, 10:00 pm CST to Dec 15, 4:00 am CST
Dec 14, 8:00 pm PST to Dec 15, 2:00 am PST
System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

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
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.

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.
JohnSeel
Advisor

Re: Using command line up arrow/down arrow

VK2Cot,
I've set up the .kshrc file. I can get my shell to recognize the up and down arrows, but all they do is echo on the command line as "^P" and "^B", etc.

Am I missing something else?

Also. I don't understand what you mean by:
Where:
^P type as CTRL-V CTRL-C P
^B type as CTRL-V CTRL-C B

Thanks.
JohnSeel
Advisor

Re: Using command line up arrow/down arrow

All,
I've loaded bash (bash-4.1.005-ia64-11.31.depot, termcap-1.3.1-hppa-11.11.depot, and gettext-0.16.1-hppa-11.11.depot -- the last two were the latest versions I could find)They all loaded successfully with swinstall.

However, when I invoke "bash" I get messages like:
/usr/lib/hpux32/dld.so: Unable to find library 'libtermcap.so'

I find the lib file it is looking for and link it back into /usr/lib/hpux32 but then it just goes to another lib file it can't find.

Two questions:
1) Why is it looking in hpux32 when I loaded a 64bit version of bash?
2) I tried setting LD_LIBRARY_PATH to various directories including where I've found the files it is looking for, but that does not seem to work. Is there another environment variable I need to set?

Thanks.
Solution

Re: Using command line up arrow/down arrow

>I don't understand what you mean by:
^P type as CTRL-V CTRL-C P
^B type as CTRL-V CTRL-C B

I think that should be:
CTRL-V CTRL-P
CTRL-V CTRL-B

You need CTRL-V to escape the next char.

>1) Why is it looking in hpux32 when I loaded a 64bit version of bash?

Why do you think it is 64 bit? The kernel and dld.so don't lie.

>2) I tried setting LD_LIBRARY_PATH to various directories including where I've found the files it is looking for

What does "chatr /path-to-bash/bash" show?
JohnSeel
Advisor

Re: Using command line up arrow/down arrow

I thought Itanium was 64bit?
My uname -a output shows:
HP-UX srvunx01 B.11.31 U ia64

Isn't that 64 bit?

JohnSeel
Advisor

Re: Using command line up arrow/down arrow

Yeah!
The escape character before the Control P was the final issue (with that anyway, I still don't know why bash doesn't work.)
To recap:
LEAVE ROOT as sh!

For other users, or when invoking ksh after logging in as root:

In the user's .profile
ENV=~/.kshrc; export ENV

In the user's .kshrc enter:

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

When entering the aliases, DO NOT cut and paste the above. The characters must be escaped with CONTROL V. So, for example ^P would be typed "CONTROL V CONTROL P", etc.

Thanks to everyone.
John
Steven Schweda
Honored Contributor

Re: Using command line up arrow/down arrow

> I've loaded bash (bash-4.1.005-ia64-11.31.depot, [...]

It's more work, but I've found it useful to
build most GNU stuff from the sources.
(Pulling a loose strand of GNU yarn does tend
to result in a lap filled with what looks
like the annual output of a whole herd of
sheep, but sometimes it's actually finite.)
When all the builds are done on your own
system, finding all the run-time stuff seems
to be less of a problem.

The current kit seems to be version 4.1 with
seven patches available, resulting in:

dyi # bash --version
GNU bash, version 4.1.7(1)-release (ia64-hp-hpux11.31)
Copyright (C) 2009 Free Software Foundation, Inc.
[...]

http://www.gnu.org/software/bash/

Re: Using command line up arrow/down arrow

>My uname -a output shows: ia64. Isn't that 64 bit?

No and yes. This is just a name so it doesn't show the mode of a particular program.
But the hardware always runs in 64 bit mode so it is only with software smoke and mirrors can you have a 32 bit application.

And the default compile mode is +DD32.

>Thanks to everyone.

If you are happy with the answers you were given, please read the following about how to assign points:
http://forums.itrc.hp.com/service/forums/helptips.do?#33