[clug] Another esoteric question...
Duncan Roe
duncan_roe at acslink.net.au
Fri Nov 21 22:49:51 GMT 2008
I always use the bash "type" builtin in preference to "which".
Then you could type "vi $(type -p mycommand.sh)"
(or use the old-style backticks - 1 less character to type ;)
Cheers ... Duncan.
On Thu, Nov 20, 2008 at 01:55:48PM +1100, Andrew Janke wrote:
> 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
> --
> linux mailing list
> linux at lists.samba.org
> https://lists.samba.org/mailman/listinfo/linux
--
Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html
More information about the linux
mailing list