Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Shell Question 1

Status
Not open for further replies.

ProudToBeLeeds

Technical User
Aug 7, 2003
35
GB
After just typing out a rather large command line and getting it wrong half way through I remembered there was a key press to put it into vi. Can any tell me what it is.


 
ksh. I can use the set -o vi which gives me the editable command line but I am sure there was a key press to load the command line into vi.

 
Hi,

Try:
export EDITOR=vi
and the hit the ESC key and used the vi navigation keys to navigate the commands.

Also, you should read the man page for ksh.

Here is an excerpt from the man page:

vi Editing Mode
There are two typing modes. Initially, when you enter a
command you are in the input mode. To edit, enter control
mode by typing ESC (033) and move the cursor to the point
needing correction and then insert or delete characters or
words as needed. Most control commands accept an optional
repeat count prior to the command.

When in vi mode on most systems, canonical processing is
initially enabled and the command will be echoed again if
the speed is 1200 baud or greater and it contains any con-
trol characters or less than one second has elapsed since
the prompt was printed. The ESC character terminates canoni-
cal processing for the remainder of the command and the user
can then modify the command line. This scheme has the
advantages of canonical processing with the type-ahead echo-
ing of raw mode.

If the option viraw is also set, the terminal will always
have canonical processing disabled. This mode is implicit
for systems that do not support two alternate end of line
delimiters, and may be helpful for certain terminals.

-Joe
 
YEah already set. I know there is a ctrl something to enter the command line into vi editor. This way a huge cli can be saved for future refrence. All I need to know is what the ctrl+ ???? Key press.


Looks like a 10-15 min read of

man ksh

for me then.

 
Don't know if it is the same but if you are more'ing a file and then press the 'v' key it dumps you into vi.
 
As joeunixadmin says, just type Esc and you can use the vi keystrokes to navigate the line.

And if you want to load the command line into file for future use, just copy the line from your .sh_history file (since you are using ksh) and paste it into another script file. Kind of kludgey, but until someone comes up with that ctrl combination to load the command line into a file...
 
Yeah had to do the grep whatever .sh_history > cli.sh


Pretty sure, in fact I know there is, a ctrl then some key. God its doing my head in !!!

Must remeber to add the manuals in next time I build a server.

 
No, it's just escape to go into command mode, and then v.

I hate it because I keep doing it by mistake. :)

Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top