[Discuss] bash problem

noel at natnix.com noel at natnix.com
Fri Aug 17 08:44:34 PDT 2007


Here's another way:

find . -type d | 
while read DIR; do
  echo DIR="$DIR"
done

~Noel


On Thu, Aug 16, 2007 at 04:00:09PM -0700, pw wrote:
> Rajiv Khaneja wrote:
> >Your problem is with this line
> >"for DIR in `find -type d`; do"
> >
> >The out put of find is being tokenized by space and newlines... so with the
> >directory "foo bar"  DIR is being set to foo first then on the next
> >iteration bar.
> >
> >I think you can do something like
> >
> >IFS=$'\n'
> >
> >and bash will only tokenize on new lines.
> >
> >
> >
> >Other than that I can't think of anything... I find it easier to just use
> >perl instead of dealing with bash string manipulation
> >
> 
> 
> You're right. IFS! Of course!
> 
> Thank you
> 
> Peter
> 
> _______________________________________________
> Discuss mailing list
> Discuss at vlug.org
> http://ladybug.vlug.org/cgi-bin/mailman/listinfo/discuss


More information about the Discuss mailing list