You are not logged in.
Pages: 1
Hi,
Can anybody explain what happens when we execute :
mv *
In a directory ?
I have tried that and found that it will move all files/directory to a sub directory. The target sub directory selection is seems to be based on the ascii order of the directory names. Not sure, if that it is. Tell me more, if know :-)
Regads,
Unni
http://www.mutexes.org/
My AUR packages
Offline
Assuming bash uses glob() for converting * to a list of files, this function returns a sorted list from which mv uses the last element as target.
man 3 glob
Offline
You can test what mv actually sees:
echo *
Offline
Look at the bash man page (search for 'Pathname Expansion') but I think (hope) that this is not the all things about bash globbing (because its so limited...).
If you can, look at zsh globbing (zshexpn man page), its really cool (you can set the order, insensitive globing, date ordered, custom true|false for each match using a external program, only match dir or sym links or files, files from only a certain user|groups, boolean glob (match all files but dont_rm_me) ) I dont know what bash can do... but the basic is in the bash man page.
Offline
This experiment should show you how it works:
mkdir testdir
cd testdir
mkdir a b c d e
ls
echo *
mv *
ls
ls e
rmdir e/* e
touch a b c d e
ls
echo *
mv *
You can find more information in man 3 glob and man 1 mv.
Offline
Pages: 1