[lug] bash scripting question

D. Frye dafr at peakpeak.com
Fri Nov 18 09:00:25 MST 2005


On Fri, Nov 18, 2005 at 08:45:53AM -0700, Hugh Brown wrote:
} I've had this problem a few times and haven't found a quick way to get
} around it.  I often do per file operations at the bash prompt with
} something like this:
} 
} for i in `ls`; do
} command $i| othercommand
} done
} 
} The problem is that if the files have spaces in them, then things break.
} 
} Is there some bash'ism that would allow me to get this to work.
} 

I've been successful in using this for some of my scripts:

cat $FILE | while read line
do
...
done

HTH,

dafr

-- 

D. Frye
dafr AT dafr.us
dafr AT peakpeak.com
http://www.dafr.us/dafr




More information about the LUG mailing list