[clue-tech] question on commands

Bruce Ediger eballen1 at qwest.net
Wed Mar 9 22:56:18 MST 2005


On Wed, 9 Mar 2005, Jeff Cann wrote:

> When I want to find a file and then immediately vi it it:
>
> $ find . -name application.properties
> ./WEB-INF/classes/application.properties
>
> $ vi ./WEB-INF/classes/application.properties
>
> Is there a way to do this in a single command ?

Sure, but it depends on the shell you use.  I assume bash, ksh (ugh!)
or zsh...

$ vi $(find . -name application.properties)
or
$ vi `find . -name application.properties`

The $(command) or `command` syntax will run that command first and
substitute its output in the "outer" command.

I use this all the time in poorly-laid-out Java projects (but I repeat
myself) to find and edit the code in one of the "package" subdirectories.



More information about the clue-tech mailing list