Using Translations to bind keys in HP-UX

Using Translations to bind keys in HP-UX

Post by Bruce A. Rothwel » Fri, 21 Jul 2000 04:00:00



-

I want to simulate the functionality we had
on Dec ALPHA systems with tcsh...

 - using the up/down arrows to traverse command history
 - using the l/r arrows to edit the command line

I know I can use "set -o emacs" to get Ctrl-P/N
to traverse command history, but our users are use
to the arrow keys.

And I can't even begin to think how I could edit the
command line.

I'd rather not use vi options, btw.

Any ideas ot references you could point me to?

__________________________________________
             Bruce Rothwell
CAD Application Engineer, Rockwell Collins

 Cedar Rapids, IA, USA, God's Green Earth

 
 
 

Using Translations to bind keys in HP-UX

Post by brian hile » Fri, 21 Jul 2000 04:00:00



Quote:> I want to simulate the functionality we had
> on Dec ALPHA systems with tcsh...
>  - using the up/down arrows to traverse command history
>  - using the l/r arrows to edit the command line
> I know I can use "set -o emacs" to get Ctrl-P/N
> to traverse command history, but our users are use
> to the arrow keys.
> And I can't even begin to think how I could edit the
> command line.
> I'd rather not use vi options, btw.
> Any ideas ot references you could point me to?

*Sigh* If this question is not in the FAQ, it should be.

My usual response is: I respect the "muscle memory" that comes from
the years of intimate familiarity with a particular system, but
now you [or your users] are using a _real_ shell (i.e. one that
isn't t/csh, although I should add that for adherents of the power
of interactive command line editting, tcsh can't be beat) it
may behoove you to simply learn ksh's command line editting techniques.

Knowing both in every detail imaginable (I am the author of a csh
to ksh translation tool; one subsystem is a translator tool of csh
history/re-editting to a ksh emulation) I have to say that csh has
nothing on ksh's capabilities, even (or should I say, _especially_
because) if some of this functionality has to be simulated with
clever user-level functions.

However... below is a function library that emulates the functionality
that you seek (written originally to coddle DEC users migrating to
Unix.) Such is the power of a well-designed shell that "featuritis"
doesn't have to be the primary outcome of sophistication.

[Because my idiot news browser is complaining that the uuencoded
function library here -- because of embedded control characters --
makes it a "binary post," I will have to send it to those that request
it via email -- God help me if 5000 of you do!]

The above makes use of an undocumented feature of ksh88 in that
aliases defined as names __<char> can be be used to map the input
streams of ESC[<char> (which are in the form of the usual strings
generated by the four arrow keys:  ESC[A (up), ESC[B (down), ESC[D
(left), and ESC[C (right)) to vi or emacs equivalents.

BTW, Ksh93 has eliminated this feature in favor of the KEYBD trap,
which allow arbitrary manipulation of the input stream. I myself
have written a library to implement multi-character associative
aliasing.  There is [was] a simple example at gtlinc.com's web
site, but the site seems to be defunct right now.

http://www.gtlinc.com/Products/KornShell/examples/

-Brian

 
 
 

1. Difference between HP-UX 10.10 and HP-UX 10.20

Hello,

what are the differences between HP-UX 10.10 and HP-UX 10.20?

I ask because one of our customers want to evalute our software
(which was developed on 10.10) on HP-UX 10.20. Is there full
backward compatibility?

Thanks for your helps

        Rainer

--
--
Rainer Freis    -       Systemadministrator

santix software GmbH
Max-Planck-Str. 7
D-85716 Unterschleissheim

Phone: (+49) 89 321506-24
Fax  : (+49) 89 321506-99

You don't know what real time-critical software is until
you're responsible for the paychecks of a battalion of
heavily armed Marines.

        (somebody in alt.sysadmin.recovery)

2. Seeking Unix Emulation Comments

3. Data Translation: HP-UX<->CICS

4. where does stdin go to...

5. NIS Binding in HP-UX 9.x

6. Fast Ethernet Intranet

7. bind problem w/Apache 1.2.6 on HP-UX

8. SB 16 Problem

9. compiling bind 834 on hp-ux 11.11

10. Revised Sec. Vulnerability BIND on HP-UX

11. Security vulnerability in the BIND on HP-UX

12. Is there a version of s/key already ported to HP-UX?

13. Looking for S/Key client program for HP-UX