Find doesn't expand {}

Conor P. Cahill cpcahil at virtech.UUCP
Fri Aug 25 22:24:34 AEST 1989


In article <12502 at well.UUCP>, tmh at well.UUCP (Todd M. Hoff) writes:
> Why doesn't this work:
> 
>     find . -type d -print -exec mkdir /xx/yy/zz/{} \;
> 
> The '{}' doesn't expand out to the filename like you might
> expect. Yet this does work: find . -exec ls {} \;. '{} expands
> to the filenames and the files are listed.

1. find looks for the {} as an explicit argument, not as a sub-part of another
   argument.  I agree with you in that {} should be substituted even if it
   is a part of an argument.

2. The find . -exec ls {} \;  will list all of the files twice (once when the
   directory is visited and once as it visits each file.   Maybe you would 
   want to use something like "find . -print".


-- 
+-----------------------------------------------------------------------+
| Conor P. Cahill     uunet!virtech!cpcahil      	703-430-9240	!
| Virtual Technologies Inc.,    P. O. Box 876,   Sterling, VA 22170     |
+-----------------------------------------------------------------------+



More information about the Comp.unix.questions mailing list