1833032 Members
2309 Online
110049 Solutions
New Discussion

Command Line Editing

 
Daniel Navarro
Occasional Contributor

Command Line Editing

Hi All,

Can anyone tell me what shell or a script that will allow a user to use the TAB key to auto complet the command line when referencing a file or directory?

For example, If I am looking in the /etc directory for editing a file called "test_file" I would like to type from the command line " vi te" and then hit the tab key to complete the rest of the line "est_file".

In Linux the bash shell allows the user to do this.

TIA,
Daniel N.
7 REPLIES 7
Christopher McCray_1
Honored Contributor

Re: Command Line Editing

Hello,

Have you tried using the escape key twice?

This works for me in sh, ksh and csh (haven't tried the others)

Hope this helps

Chris
It wasn't me!!!!
A. Clay Stephenson
Acclaimed Contributor

Re: Command Line Editing

Well, you can install bash. It's available from any of the HP-UX Porting Centre's. However, DO NOT make it root's shell.
If it ain't broke, I can fix that.
MANOJ SRIVASTAVA
Honored Contributor

Re: Command Line Editing

Hi Daniel

set teh shell to ksh or at teh porpmt give like kash -o vi and then you can use the escape charater to get the file matched to first indentified unique string.

Manoj Srivastava
Arockia Jegan
Trusted Contributor

Re: Command Line Editing

If you have bash shell in hpux you can do that by using TAB key.

Adding to christoper point,

you can use \ (escape key and back slash) to do that.

Bill Hassell
Honored Contributor

Re: Command Line Editing

Filename completion (the TAB or ESC key feature) as well as command line recall and editing are part of the POSIX standards. HP's standard shell is called the POSIX shell but has the name: sh which is easily confused with the Bourne shell (which is located in /usr/old/bin). ksh (and bash) are also POSIX shells.

To turn on the shell history/filename completion features, you must have the env variable $HISTFILE set to a history file. ksh and bash default to $HOME/.sh_history, but the POSIX shell requires HISTFILE to be explicitly set. Make sure HOSTFILE is set in /etc/profile or .profile:

export HISTFILE-$HOME/.sh_history
oops:
export HISTFILE=$HOME/.sh_history


Bill Hassell, sysadmin
Steven Sim Kok Leong
Honored Contributor

Re: Command Line Editing

Hi,

export HISTFILE=$HOME/.sh_history

Just too bad that the keyboard has the key - right adjacent to =.

Hope this helps. Regards.

Steven Sim Kok Leong
Bill Hassell
Honored Contributor

Re: Command Line Editing

Thanks Steven. Since I never make misteaks when I tipe, it must be a defective keybored. ;-)


Bill Hassell, sysadmin