[K12OSN] Script Error with file names that have spaces

Jim Kronebusch jim at winonacotter.org
Wed Sep 1 15:12:08 UTC 2004

A while back I was provided the following script for changing
permissions on files:
for file in /home/Drop/*
do owner=$(ls -ld $file|awk '{print $3}')
chown -R $owner $file

Now I am running into problems with it not knowing how to handle files
with spaces in them such as "my homework" instead of "myhomework".  Now
I know that if I run the commands manually at a command line I am able
to contain the filename in quotes to solve this but I don't know how to
incorporate that into this script.  Any help would be appreciated.


Jim Kronebusch
Cotter Tech Department
jim at winonacotter.org 

Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.744 / Virus Database: 496 - Release Date: 8/24/2004

This message has been scanned for viruses and
dangerous content by the Cotter Technology 
Department, and is believed to be clean.

More information about the K12OSN mailing list