[clug] Another esoteric question...

Andrew Janke a.janke at gmail.com
Thu Nov 20 02:55:48 GMT 2008


Given that my last question (terminal encoding: ^V^O) was so
comprehensively answered. Here is another of my niggling shell
questions that has annoyed me for a long time.

Is there a way where you can use some sort of variable in a subsequent
command that matches the output of the last command ala !$ with the
last argument from the previous command.

ie:

   $ which mycommand.sh
   /usr/local/bin/mycommand.sh

   $ vi <something>

Where <something> is /usr/local/bin/mycommand.sh

Currently I do this via a dodgy shell function 'vs' (vi script):

   function vs () {
      vim `which "${1}"`
      }

ta


-- 
Andrew Janke
(a.janke at gmail.com || http://a.janke.googlepages.com/)
Canberra->Australia    +61 (402) 700 883


More information about the linux mailing list