On Wednesday 28 July 2010 21:37:44 Karl Vogel wrote:
On Thu, 29 Jul 2010 01:04:27 -0000,
Cameron Hutchison<lists@xdna.net> said:
C> find $MAGDIR -iname '*.zip' -print0 | xargs -0 some-command
C> -iname matches names case insensitively. Since you then dont need grep,
C> you also dont need tr0.
I need to think before posting. I didn't mention that I have FreeBSD,
Linux, and Solaris boxes, and unfortunately I can't guarantee the same
access to GNU find. I can install xargs if the system version doesn't
recognize the "-0" option, so I usually end up scripting for the lowest
common denominator.
In that case, you'll have to be very careful in order to handled file names
that contain IFS characters or newlines:
find "$MAGDIR" -name "*.[zZ][iI][pP]" -exec \
sh -c 'handle_single_file "$1"' ignored {} \;
That will work on any POSIX system, or most systems with POSIX-conforming find
and sh. You *may* have to specify full paths to the POSIX-conforming find and
sh commands.