On Fri, 15 Feb 2008, Randall R Schulz wrote:-
On Thursday 14 February 2008 23:13, David C. Rankin wrote:
...
Stumbling around, it seems if you include AFS='\n' it will keep the loop from breaking on spaces by specifying that it only break on newlines and not spaces. So filenames with spaces (all my wife's digital pictures are) this is the only thing I have found to work without extensive character and replacing spaces with '_':
It's "IFS" not "AFS" and you need the "in" keyword as David Bolt mentioned:
And if the script is more than just a quick one-liner, you should really be saving and restoring the old IFS, or you can end up with some rather difficult to diagnose failures. You can find an example of this is in /etc/init.d/alsasound === start snippet === load_sequencer() { test "$LOAD_SEQUENCER" = "yes" && modprobe -q snd-seq if [ x"$LOAD_SEQUENCER" = xyes -a -r /proc/asound/seq/drivers ]; then OLDIFS="$IFS" IFS="," while read t x c; do /sbin/modprobe $t done < /proc/asound/seq/drivers IFS="$OLDIFS" fi } === end snippet === One interesting aside here is the use of the test: [ x$c = x ] a little later in that script. Why on earth they didn't use this instead is an interesting puzzle: [ -z "$c" ] Regards, David Bolt -- Team Acorn: http://www.distributed.net/ OGR-P2 @ ~100Mnodes RC5-72 @ ~15Mkeys SUSE 10.1 32bit | openSUSE 10.2 32bit | openSUSE 10.3 32bit | openSUSE 11.0a1 SUSE 10.1 64bit | openSUSE 10.2 64bit | openSUSE 10.3 64bit RISC OS 3.6 | TOS 4.02 | openSUSE 10.3 PPC | RISC OS 3.11 -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org