On Mon, 25 Jul 2011 14:07:11 -0400, Bill M <bi...@uniserve.com> wrote:

Hi folks,

I'm piecing together a small script to remove duplicate messages from various directories in Icedove. By default the files are stored in a directory called 'Local Folders' - with the space - and this seems to be
creating a problem for bash. I can both cd to "Local Folders" and cd to
Local\ Folders from the command line but within the script it's a different story. Bash refuses to recognize "Local Folders" as a directory and breaks at the whitespace. Here's the script and the error output. Any help appreciated.

        bill

#! /bin/bash

# A script to remove duplicate messages

FILES=/home/bill/.icedove/qjimvr85.default/Mail/Local\ Folders/2-Personal.sbd/* # or "/home/bill/.icedove/qjimvr85.default/Mail/Local Folders/2-Personal.sbd/*"

for i in $FILES
do
         mv "$i" ""$i".saved"
         formail -D 65536 .msgid.cache -s < ""$i".saved" > "$i"
done

mv: cannot stat `/home/bill/.icedove/qjimvr85.default/Mail/Local': No such file or directory ./mailscript: line 10: /home/bill/.icedove/qjimvr85.default/Mail/Local.saved: No such file or directory
mv: cannot stat `Folders/2-Personal.sbd/*': No such file or directory
./mailscript: line 10: Folders/2-Personal.sbd/*.saved: No such file or directory



Bash is treating FILES as an array of
/home/bill/.icedove/qjimvr85.default/Mail/Local and
Folders/2-Personal.sbd/*
Try this instead:
FILES = `ls '/home/bill/.icedove/qjimvr85.default/Mail/Local
Folders/2-Personal.sbd/'` OR
FILES = `ls /home/bill/.icedove/qjimvr85.default/Mail/Local\
Folders/2-Personal.sbd/`
Notice the backticks around the command and the single quotes (could also
be double) around the path.
The backticks means to substitute the output of the command into $FILES.

HTH,
Mike

--
Michael Checca
echo "complaints" > /dev/null


--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/op.vy6tkixz4b8ft1@michael-laptop

Reply via email to