Hello,

I have a small script which uses the find command to locate files and then
does an 'ls -lAd' on them (don't ask why, it's not important). This however
has failed nicely when it hits files with spaces in them!

I have as a test:

   for FNAME in `find /tmp -type f -maxdepth 1 -printf '"%p"\n' `; do
          ls -l "$FNAME"
   done

This is about as close as I can get to solving the problem but it still
doesn't work correctly. I get the following errors (this is with the '-x'
option set on the shell):

+ find /tmp -type f -maxdepth 1 -printf "%p"\n
+ ls -l "/tmp/acout.a29033"
ls: "/tmp/acout.a29033": No such file or directory
+ ls -l "/tmp/me
ls: "/tmp/me: No such file or directory
+ ls -l and
ls: and: No such file or directory
+ ls -l me"
ls: me": No such file or directory
+ ls -l "/tmp/28786baa"
ls: "/tmp/28786baa": No such file or directory

The /tmp directory has a file called 'me and me' in it. The script uses the
Korn shell, but the same happens under bash. I have tried using '-exec echo'
and xargs but nothing seems to simply list the files regardless of whether
they have spaces in or not.

If anyone has any other ideas I would be grateful,

John.

--------------------------------------------------------------------------
John Horne, University of Plymouth, UK             Tel: +44 (0)1752 233914
E-mail: [EMAIL PROTECTED]
Finger for PGP key: [EMAIL PROTECTED]


-- 
To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
as the Subject.

Reply via email to