On Thu, 15 Jul 2004, Matthias Czapla wrote:

I have no idea, but I use something like this to recurse down a tree and
do something with every file:

#!/bin/bash
for i in `find -type f`
do
     whatever you wan't to do, just use $i instead of the filename.
done

This will not work if any component of a path contains spaces. If this is not the case then there is nothing wrong with this approach, IMHO.

If you just add the following statement, then the above loop will work fine:
IFS='[return]
'


That is, set IFS to be a carriage return and nothing else. That will cause 'for' to only split on carriage returns, which works just dandy. And generally much more readable than find.

--
I was an only child...  eventually.  -- Stephen Wright
---------------------------------------------------------------------
Luke Kanies | http://abstractive.org | http://reductiveconsulting.com


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]




Reply via email to