[mvparent] Get rid of useless error messages

Test the presence of files in the directory before to call mv, in order
to avoid useless mv error message.
This commit is contained in:
Matteo Cypriani 2012-10-01 15:31:56 +02:00
parent 236e5afe48
commit 7896c2ce60
1 changed files with 9 additions and 1 deletions

View File

@ -26,5 +26,13 @@ fi
echo "Move the contents of « $rep/$cible » into « $rep »…" >&2
cd "$rep"
mv "$cible"/* "$cible"/.[!.]* .
if [ "$(echo "$cible"/*)" != "$cible/*" ] ; then
mv "$cible"/* .
fi
if [ "$(echo "$cible"/.[!.]*)" != "$cible/.[!.]*" ] ; then
mv "$cible"/.[!.]* .
fi
rmdir "$cible"