Re: Whitespace problem with bash script for Icedove
Bill M wrote:
> 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
>
This appears to be related to the default value of the BASH internal
variable $IFS (internal field separator). It defaults to whitespace,
which includes the space character. The for loop interprets the space
inside $FILES as a field separator. Try setting $IFS to ONLY new line
above the for loop.
IFS=$'\n'
for i in $FILES
..
..
..
Mark Neyhart
Reply to: