General
cancel
Showing results for 
Search instead for 
Did you mean: 

autocompletion in HP-UX default shells

Andy Kosela
Frequent Advisor

autocompletion in HP-UX default shells

Has ksh(1) in default HP-UX system got autocompletion (tab autocompletion)?
12 REPLIES
Matt Palmer_2
Respected Contributor

Re: autocompletion in HP-UX default shells

Hi,

I have tried this on my system, and ksh doesnt appear to have tab completion, it does have access to a history but I'm pretty sure that you cant use the arrow keys to do this. Also be aware that the ksh I have used is a 32bit port from the hpux developers site, so I dont think its 64bit aware.

http://hpux.connect.org.uk/

hope that helps

regards

Matt
Matti_Kurkela
Honored Contributor

Re: autocompletion in HP-UX default shells

There is a basic filename completion feature, but it is not enabled by default and the keystroke is different.

To use the filename completion in HP-UX ksh, you must first activate one of the editing modes (emacs, gmacs or vi). This is done with a command like "set -o emacs" or "set -o vi".

When the vi editing mode is enabled, filename completion can be attempted by typing "ESC \".

If you use the emacs/gmacs editing mode, the keystroke is usually "ESC ESC". (Depending on your terminal settings, Alt-ESC might also work in some cases.)

In both cases, the filename will be completed only if the shell finds exactly one matching file or directory. If it's a directory, "/" will be appended to the name automatically.

This information can be found in the ksh man page, by searching for the word "completion".

MK
MK
Michal Kapalka (mikap)
Honored Contributor

Re: autocompletion in HP-UX default shells

hi.

its depend on your setting

set -o vi

or emacs

set -o emacs

http://geosoft.no/development/emacs.html

mikap

PS : i'm using set -o vi
Andy Kosela
Frequent Advisor

Re: autocompletion in HP-UX default shells

ok, but it only has filename completion, *not* command completion.

I found out the default csh on HP-UX has *both* filename completion and command completion, but it seems it doesn't have vi-editing mode?
or am I missing something?

Also what is the quick way to remap esc completion to tab completion?
Dennis Handly
Acclaimed Contributor

Re: autocompletion in HP-UX default shells

>(tab autocompletion)?

No, you must use ESC.

>I found out the default csh on HP-UX has *both* filename completion and command completion, but it seems it doesn't have vi-editing mode? Or am I missing something?

No, I don't call it scummy C shell for nothing. Don't even think of using it.

>what is the quick way to remap esc completion to tab completion?

There isn't for HP-UX's ksh and sh.

>MK: When the vi editing mode is enabled, filename completion can be attempted by typing "ESC \".

That's ESC ESC.

>the filename will be completed only if the shell finds exactly one matching file or directory.

You can use ESC * for all, and ESC = to show you the list.
Andy Kosela
Frequent Advisor

Re: autocompletion in HP-UX default shells

>No, you must use ESC.

Is there some workaround for this? tab is much simpler to use as this key is located near my usual left hand position on the keyboard.

>I found out the default csh on HP-UX has >*both* filename completion and command >completion, but it seems it doesn't have >vi-editing mode? Or am I missing something?

>No, I don't call it scummy C shell for >nothing. Don't even think of using it.

If only csh had vi-editing mode it would be much better than POSIX sh as I prefer to use *one* key to autocomplete and not *two*.
Matti_Kurkela
Honored Contributor

Re: autocompletion in HP-UX default shells

If you want to access the command history with sh/ksh using the arrow keys, you must use the emacs/gmacs editing mode, and you must explicitly set some softkey aliases to make the arrow keys work:

set -o emacs

# hpterm cursor keys
alias -x _A=$(echo '\020')
alias -x _B=$(echo '\016')
alias -x _D=$(echo '\002')
alias -x _C=$(echo '\006')

# vt100 normal (non-application) cursor keys
alias -x __A=$(echo '\020')
alias -x __B=$(echo '\016')
alias -x __D=$(echo '\002')
alias -x __C=$(echo '\006')

# Home and End for typical vt100 emulations
alias -x __H=$(echo '\001')
alias -x __F=$(echo '\005')

MK
MK
James R. Ferguson
Acclaimed Contributor

Re: autocompletion in HP-UX default shells

Hi Andy:

The HP-UX Posix shell ('/sbin/sh') _must_ be used for the root account. To change this will cripple a reboot.

The default Posix shell for non-root user's is the dynamically linked '/usr/bin/sh'.

One option might be to install a Bash shell (e.g. from the HP Porting Centre).

http://hpux.connect.org.uk/hppd/hpux/Shells/bash-4.0.010/

If you choose to install the bash shell, be sure to install its dependencies!

As Dennis, noted, the C shell is a brain-dead dysfunctional shell that should be avoided.

Regards!

...JRF...
OldSchool
Honored Contributor

Re: autocompletion in HP-UX default shells

"If only csh had vi-editing mode it would be much better than POSIX sh as I prefer to use *one* key to autocomplete and not *two*."

let's see....it absolutely can't be used as root's default shell....it has issues if its a users default shell w/ CDE, then there's always "csh programming considered harmful" at:

http://faqs.cs.uu.nl/na-dir/unix-faq/shell/csh-whynot.html

bash is a better alternative if you absolutely insist that you must have command completion w/ 1 keystroke I guess. and you could always start it after a successful login (if needed) when logging in as "root"
Andy Kosela
Frequent Advisor

Re: autocompletion in HP-UX default shells

Matti Kurkela,

I don't need arrow keys at all. I grew up on vi(1) so I pray by . What I need is to remap (even by soft alias or whatever) tab to esc key, so then I will be able to use tab instead of esc, which is annoying for me. Is this somehow possible?
Andy Kosela
Frequent Advisor

Re: autocompletion in HP-UX default shells

OldSchool, I'm perfectly aware of *all* the points you mentioned. My preferred interactive shell is tcsh by the way, but in our environment we need to use the default HP-UX shells.
OldSchool
Honored Contributor

Re: autocompletion in HP-UX default shells

it is what it is. esc - esc or bust