[clue-tech] question on commands

Keith Hellman khellman at mcprogramming.com
Wed Mar 9 23:44:41 MST 2005


On Wed, Mar 09, 2005 at 07:30:18PM -0700, 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 ?

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

Note the punctuation character is a backtick in the second example.
Both of these are identical, AFAIK, syntax telling the shell to *first*
run the find command, replace all runs of whitespace (including newline) 
with 1 space, and then insert the output into the second command
argument list.

If you want to take use the output as only one parameter (another use
case, I can't see why you would want to with vi invokation), then you
can quote the "interior command":
 
  $ vi "$(find . -name application.properties)" 

HTH

-- 
Keith Hellman                             #include <disclaimer.h>
khellman at mcprogramming.com                from disclaimer import standard
public key @ www.mcprogramming.com

Experience is a harsh teacher.  She gives the test before you learn the
lesson.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://cluedenver.org/pipermail/clue-tech/attachments/20050309/a9e9b1ac/attachment.bin


More information about the clue-tech mailing list