[Discuss] bash problem

pw p.willis at telus.net
Fri Aug 17 14:15:14 PDT 2007


David Bronaugh wrote:
> pw wrote:
>> #!/bin/bash
>>
>> export START=`pwd`
>>
>> for DIR in `find -type d`; do
>>     cd $DIR;
>>     cd $START;
>> done
>>
>> #END IF SCRIPT
>>
> Why not find . -type d -exec "stuff"?
> 
> David

Hello,

I guess I could do that.
The script (which now works fine) is searching for
empty directories from a specific starting point.
The script then either adds a file placeholder
or removes the empty directory.

There's some logic inside the loop but it could
possibly be shoehorned into the exec....(?)

Putting it inside the loop makes it more clear,
after 6 months of not looking at it, what the intent
of the script was from a step-wise perspective.

Peter



More information about the Discuss mailing list