[nzlug] bash help - for loop listing dirs
Howard
howard-nzlug at fox.co.nz
Thu Feb 22 07:31:32 NZDT 2007
Hi, I'm after some bash script help please...
I have a for loop which I thought would need to be thus:
for i in `ls -1`
do
cd $i
blah...
I need to recursively list dirs, then do some stuff. Some dirs have
spaces in their names, and these are listed as separate words in the
loop... causing the dir names to be incorrect (breaks in for loop occur
at spaces).
I have briefly googled and had a suggestion to use IFS or maybe tr to
changes the spaces to something else first... and not being a skilled
basher can someone give me an example please of an 'accepted' way to do it?
Thanks
H
More information about the NZLUG
mailing list