[K12OSN] Script Error with file names that have spaces

Jim Kronebusch jim at winonacotter.org
Wed Sep 1 15:43:29 UTC 2004


> A non-quoted backslash `\' is the Bash escape character. It 
> preserves the literal value of the next character that 
> follows, with the exception of newline. If a \newline pair 
> appears, and the backslash itself is not quoted, the \newline 
> is treated as a line continuation (that is, it is removed 
> from the input stream and effectively ignored).
> 
> So escape your " with a \

I must be a little slow today, I don't quite get what you are saying
here.  Could you insert the \ as an example in the following script?

#!/bin/bash
for file in /home/Drop/*
do owner=$(ls -ld $file|awk '{print $3}')
chown -R $owner $file
Done

Here is an example of the error I am getting:

chown: failed to get attributes of `/home/Drop/Network': No such file or
directory
chown: failed to get attributes of `Trash': No such file or directory
chown: failed to get attributes of `Folder': No such file or directory

---
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