Subject: Re: [Expert] Bug in mv?

From: Gene Heskett <[email-masked]>
Date: Tue, 04 May 2010 23:09:01 -0400

On Tuesday 04 May 2010, João Victor Martins wrote:
>On Tue, May 04, 2010 at 10:36:19PM -0400, Gene Heskett wrote:
>> I tried to "mv amanda* /home/amanda/*" as root and which
>> which I recall I have done successfully several times before.
>
>The shell expand * _before_ passing the args to mv.  So mv saw all
>files starting with 'amanda' and all files (besides . hidden ones) in
>/home/amanda/ as arg.  It then picked the last one listed (probably
>/home/amanda/tmp/) as destination.
>
I had two files whose names started with amanda in that directory.  I would 
have assumed it would expand the src pattern of "amanda*" to match only those 
two files.  And the rest of the files in /home/me, weren't bothered.  No 
damages to the src directory at all other than removing the files.

If it expanded that * to include the whole thing, it should have moved the 
whole thing.  It didn't.  In past experience, the target path spec's /* has 
always served as just a place holder for the filenames actually selected by 
the amanda* in the src spec.  That is not what it did this time.  This time 
it created a tmp/ directory in /home/amanda, moved the whole amanda tree to 
the tmp directory, including the two files I actually asked it to move from 
/home/me/Download.  No loss, but a very surprised veteran linux user.

Someplace, the plans of mice and men have definitely gone aglay here, so I've 
included [email-masked].

-- 
Cheers, Gene
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Every nonzero finite dimensional inner product space has an orthonormal 
basis.

It makes sense, when you don't think about it.