A long time ago (Fri, Oct 26, 2001 at 06:06:34PM +1000), in a galaxy far far away, 
Matthew Dalton wrote :
> Matt Hyne wrote:
> > 
> > Unfortunately this then treats the entire 'ls' as a single element and prints that 
>when I print FILE.
> > 
> > ie the whole of the ls output is printed between the >xxx< quotes.
> 
> Well yeah, because the for statement is only seeing one argument - "`ls
> -l`". Remove the quotes around this for it to work.

That would bring him back to the initial problem.... spaces in the filename.

The way I do it is :

find "$1" -name '*' -printf '%p\n'| 
(
        while read i; do
                echo "$i"
        done
)

However, that would breaak for files which has newlines in their names :> I recall 
reading somewhere that the only characters not allowed in a UNIX filenames are `.' and 
`/'.
        

> 
> 
> > 
> > Matt
> > 
> > At Friday, 26/10/2001 03:24 PM (+1000), George Vieira wrote:
> > >try this
> > >
> > >for FILE in "`ls -1`"; do echo ">$FILE<"; done
> 
> -- 
> SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
> More Info: http://lists.slug.org.au/listinfo/slug
> 

-- 
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug

Reply via email to