Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Oct 2005 20:42:33 +0100
From:      Mark Cullen <mark.r.cullen@gmail.com>
To:        Drew Tomlinson <drew@mykitchentable.net>
Cc:        FreeBSD Questions <freebsd-questions@freebsd.org>
Subject:   Re: Help With 'for' Loop
Message-ID:  <43500A29.4020008@gmail.com>
In-Reply-To: <435007F3.8000106@mykitchentable.net>
References:  <435007F3.8000106@mykitchentable.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Drew Tomlinson wrote:
> Sorry to be such a pest today.  I'm working on a sh script that uses a 
> for loop.  To test, I've written the following:
> 
> for i in `/usr/bin/find /multimedia/Pictures -iname "*.jpg" -or -iname 
> "*.gif" -print`
>        do
>        echo -e "\n$i"
> done
> 
> The first line 'find' returns is "/multimedia/Pictures/1998 
> Christmas/April01.JPG"
> 
> 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?
> 
> Thanks,
> 
> Drew
> 

Wild guess.. I would say try something like this...

for i in "`/usr/bin/find /home/mrboo -iname \"*.jpg\" -or -iname 
\"*.gif\" -print"
`
do
        echo -e "\n$i"
done





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?43500A29.4020008>