editing bash command line with vi | Unix Linux Forums | UNIX for Dummies Questions & Answers

  Go Back    


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

editing bash command line with vi

UNIX for Dummies Questions & Answers


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 09-03-2002
peter.herlihy peter.herlihy is offline
Registered User
 
Join Date: Nov 2001
Last Activity: 1 August 2006, 11:51 AM EDT
Location: New Zealand
Posts: 333
Thanks: 0
Thanked 0 Times in 0 Posts
editing bash command line with vi

Is there a way using bash that I can edit a command line using vi.

I.e. if I have a long command line and I want to edit it.....by typing vi and then having the command open in an editing window....

I beleive this can be done in k shell by pressing v....however can find out how this can be done in bash.
Sponsored Links
    #2  
Old 09-03-2002
asifraj's Avatar
asifraj asifraj is offline
Registered User
 
Join Date: Aug 2002
Last Activity: 17 October 2003, 10:33 PM EDT
Location: India
Posts: 48
Thanks: 0
Thanked 0 Times in 0 Posts
MySQL

is it really needed

why not use the vi first.

i mean to say that you can write the command in a file using the vi editor and then execute it

i just tried this also which may sound a bit funny

alias "exec=vi /tmp/file;sh /tmp/junk"

now when you say exec, it would open a file, you can write your command in that and when you save and exit, it would execute that same file.
Sponsored Links
    #3  
Old 09-03-2002
peter.herlihy peter.herlihy is offline
Registered User
 
Join Date: Nov 2001
Last Activity: 1 August 2006, 11:51 AM EDT
Location: New Zealand
Posts: 333
Thanks: 0
Thanked 0 Times in 0 Posts
Cheers... although not what I'm after.... I'm comfortable with editing the command line (esp with bash using the arrow keys and ctrl+a and crtl+e)....but was just curious if there is a way to do what I have asked. I'm really not after a work around as I know plenty....just adding some artillery to my skills really.

    #4  
Old 09-03-2002
LivinFree's Avatar
LivinFree LivinFree is offline Forum Advisor  
Goober Extraordinaire
 
Join Date: Jul 2001
Last Activity: 16 June 2011, 4:50 PM EDT
Location: Portland, OR, USA
Posts: 1,626
Thanks: 2
Thanked 15 Times in 13 Posts
You should be able to put a "set -o vi" in your .bashrc...
I think you will have to press [Esc] first to put it in edit mode...
Try it out.

Type "set -o" to get a list of options - the only downside is that you won't be in emacs mode anymore, so arrows won't work (to scroll up, you'll have to type "[Esc]" then "k" for example).
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Bash - Loading a command's output line by line into an array Azrael Shell Programming and Scripting 4 09-20-2011 04:42 AM
Running set options from the command line and bash command Straitsfan UNIX for Dummies Questions & Answers 5 07-28-2011 11:27 AM
ksh command line editing text being overwritten jeffa123 UNIX for Dummies Questions & Answers 2 10-01-2009 08:17 AM
Single line file editing command? gator76 Shell Programming and Scripting 1 04-03-2008 10:09 AM



All times are GMT -4. The time now is 06:11 PM.