On 10/14/2005 1:05 PM Will Maier wrote:
On Fri, Oct 14, 2005 at 12:33:07PM -0700, Drew Tomlinson wrote:
[...]
Yet 'echo $i' only returns "/multimedia/Pictures/1998", stopping
at the first space. Is it possible to get 'i' to represent the
whole string that 'find' returns? If so, how?
Bourne-style for loops use <space> as the delimiter by default. To
change this behavior, modify the IFS variable (which is mentioned
but not explained in the sh manpage):
$ OLDIFS=$IFS # probably want to remember this value
$ IFS=:
$ export $IFS
$ for i in $PATH; do
echo $i
done
/home/will/bin
/usr/local/sbin
/usr/local/bin
/usr/sbin
/usr/bin
/sbin
/bin
/usr/X11R6/bin
/opt/
/usr/games/
$ IFS=$OLDIFS # set it back to normal
$ export $IFS
$ for i in $PATH; do
echo $i
done
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin:/opt/:/usr/games/
Thanks for this explanation. I will look at the sh man page.
Cheers,
Drew
--
Visit The Alchemist's Warehouse
Magic Tricks, DVDs, Videos, Books, & More!
http://www.alchemistswarehouse.com
_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"