Re: MV Command...

From: Michele Andreoli (m.andreoli@tin.it)
Date: Wed Dec 13 2000 - 11:57:12 CET


On Wed, Dec 13, 2000 at 10:46:22AM +0100, Jochen Cichon nicely wrote:
>
> Can u change the gateway so that MV is more user friendly...
> for the new 11r3 :)
>
> ---- OLD
>
> if [ -f "$1" ] ; then
> cp $1 $2
> rm -r $1
> else
> echo "$1 is not a file. Use cp & rm."
> fi
>
> ---- NEW
>
> if [ -d "$1" ] ; then
> cp -r $1 $2 && rm -r $1
> elif [ -f "$1" ] ; then
>
> cp $1 $2 && rm $1
> else
> echo "$1 is not a file. Use cp & rm."
> fi
>
> ----
>
>
> So it now supports DIRECTORY moving and only REMOVE if copy has done it's job.
> Maybe the last else is not required but pessimism.
>

It is better, but still it is dangerous. I implemented your
suggestion, but in my opinion it is better to refuse to work
with directories

Michele

-- 
In summing up, I wish I had some kind of affirmative message to leave
you with, I don't. Would you take two negative messages? - Woody Allen
---------------------------------------------------------------------
To unsubscribe, e-mail: mulinux-unsubscribe@sunsite.auc.dk
For additional commands, e-mail: mulinux-help@sunsite.auc.dk


This archive was generated by hypermail 2.1.6 : Sat Feb 08 2003 - 15:27:17 CET