[SGVLUG] bash "for" with spaces

John E. Kreznar jek at ininx.com
Mon Apr 19 21:16:16 PDT 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

>> foo "$f"

> Where possible (and it is most often possible), the "find -print0 |
> xargs -0" idiom works well too.

Very nice.  Thanks!  The cases where things seem to get baroque may be
when the list is the result of a computation.  Example:

   for f in $(grep -l bar *) ; do foo $f ; done

where again, file names may contain blanks.  As I recall, I've been
driven to fiddling with the IFS shell parameter.  Very messy.

- -- 
 John E. Kreznar jek at ininx.com 9F1148454619A5F08550 705961A47CC541AFEF13

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8+ <http://mailcrypt.sourceforge.net/>

iEYEARECAAYFAkvNKkkACgkQYaR8xUGv7xPt7wCePawIUHq+HwlDgezTA6z+p9Ou
gpcAn0qITqGRcZdhrOD8gL5teNJoEwv3
=6X47
-----END PGP SIGNATURE-----



More information about the SGVLUG mailing list