On Sat, 17 May 2008 23:30:51 Randall R Schulz wrote:
[...]
#!/bin/bash
for file in `find * -print0 | xargs --null`
The way you're using xargs is essentially a no-op here, since the output is no different than if you skipped the xargs part.
However, if you put the action code into a separately executable script file that takes multiple arguments and gave that command to xargs, you'd have what you want.
So if your script was something like this:
-==--==--==--==--==--==--==--==--==--==--==--==--==--==--==- #!/bin/bash --norc
for arg; do
# Do stuff with "$arg" (always quote it!)
done -==--==--==--==--==--==--==--==--==--==--==--==--==--==--==-
Then just invoke it like this:
% for file in $(find * -print0 | xargs --null scriptName)
do { ... } done
By the way, these braces are redundant.
Thanks, Randall. That does make sense. Incidentally, using the following line: for file in `xargs --null < `find * -print0`` despite errors mentioned in my first post, the script actually does run and do exactly what I want it to do. Of course when it tries to operate on "find" and "-print0" it generates an error and continues on to the other files in the directory. That must be something to do with the nested command substitution... Anyway, thanks for your help. I'm always amazed the stuff one can learn on this list. Regards, Rodney. -- =================================================== Rodney Baker VK5ZTV rodney.baker@iinet.net.au ===================================================