It is currently Tue, 17 May 2022 01:35:00 GMT



 
Author Message
 recall of previous command tokens in bash or kornshell
hello,
    I am using bash, well there's not much point in using anything else is
there?

Anyway say I type and execute:

ls -l xxx yyy zzz

and then for my next command I want to vi the file called 'zzz', a good way
to do that is to type:

vi ESC .

to get the last token of the previous command. I learnt this from the
kornshell man page and it works in bash as well. Now I know there is a way
to access the last but one token, or any of the other tokens, and I used to
know how to do it, but I forgot, so someone please tell me, cause I want an
easy life. Thanks.



 Sun, 01 May 2005 02:37:24 GMT   
 recall of previous command tokens in bash or kornshell
In article <3dd14b99$0$13372$cc9e4...@news.dial.pipex.com>,

RTFM.  From the bash man page:

     yank-nth-arg (M-C-y)
          Insert the first argument to the previous command (usu-
          ally  the  second  word  on the previous line) at point
          (the current cursor position).   With  an  argument  n,
          insert  the  nth  word  from  the previous command (the
          words in the previous command begin with  word  0).   A
          negative  argument inserts the nth word from the end of
          the previous command.

You can also type C-p to recall the previous command, and then you can use
Emacs-style editing of the entire command line.

--
Barry Margolin, bar...@genuity.net
Genuity, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.



 Sun, 01 May 2005 03:07:46 GMT   
 recall of previous command tokens in bash or kornshell

use !:<token>   ... where token is (starting at 0) the 'word' you want to
use.  For example, if your last command was:
ls foo bar car
and you want to vi bar, you could type vi !:2

bash explains it all in the history section



 Sun, 01 May 2005 03:21:14 GMT   
 
   [ 3 post ] 

Similar Threads

1. Hoe to recall previous unix commands

2. unable to recall/edit previous commands in tcsh

3. Recalling Previous Commands in C-shell

4. for previous dos users (make bash->command.com)

5. recall a command in command line?

6. BASH BASH BASH BASH BASH BASH BASH BASH BASH BASH

7. Command to wait for previous process/command to finish

8. Difference between BASH and Kornshell

9. recalling shellscripts in bash

10. vi set commands using kornshell


 
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software