Re: Shell question

Axel Luttgens <[email protected]> Tue, 20 Mar 2012 16:53:12 +0100
Newsgroups gmane.comp.macosx.admin
Message-ID <[email protected]>
Le 20 mars 2012 à 16:20, LuKreme a écrit :

> I have the following line in a bash script
> 
> mv "$H_PATH/*" "${UROOT}${i}/Maildir/cur/"
> 
> which throws the error
> 
> mv: rename /home/kreme/Maildir/.NotJunk/cur/* to /home/kreme/Maildir/cur/*: No such file or directory
> 
> but:
> 
> # mv /home/kreme/Maildir/.NotJunk/cur/* /home/kreme/Maildir/cur/
> #
> 
> which moves the 6 messages in .NotJunk/cur to the Inbox.

The double quotes in

	"$H_PATH/*"

preserve the literal value of character *.
As a result, pathname expansion won't occur and the mv command will be applied to a file named "*" located in directory "/home/kreme/Maildir/.NotJunk/cur/" and that should be moved to directory "/home/kreme/Maildir/cur/".
If you want to keep the double quotes because you fear to encounter some problematic characters in H_PATH, this one should be fine:

	"$H_PATH/"*

HTH,
Axel