[SGVLUG] bash "for" with spaces [was: Re: Thanks for bash -c puzzle]

Christopher Smith x at xman.org
Mon Apr 19 20:53:21 PDT 2010


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

--Chris

On Apr 19, 2010, at 8:04 PM, Rod Morison <rod at morison.biz> wrote:

> foo "$f"
> 
> On 4/19/2010 7:47 PM, John E. Kreznar wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>> 
>> While the subject of bash quoting is hot, does anyone know a simple
>> idiom to replace
>> 
>>    for f in * ; do foo $f ; done
>> 
>> in cases where the directory has files whose names contain spaces?
>> 
>> - --   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/>
>> 
>> iEYEARECAAYFAkvNFXcACgkQYaR8xUGv7xOuiwCfbqTwISn8sBwtFGdOomEbCXnl
>> E/UAnjiQdUHGQ8Z3H7pED+xf/lVS0sLw
>> =8IZB
>> -----END PGP SIGNATURE-----
>> 
>>   


More information about the SGVLUG mailing list