Creating a nondestructive 'rm'
Maarten Litmaath
maart at cs.vu.nl
Sat Nov 5 10:45:35 AEST 1988
In article <4460006 at hpindda.HP.COM> burdick at hpindda.HP.COM (Matt Burdick) writes:
\Does anyone have a nice alias or shell script so that when I 'rm' a file it
\will actually move it to, for instance, a tmp subdirectory in my home
\directory?
\
\Right now, I have an alias that does this, but the problem is that may
\alias doesn't handle all of rm's flags. For instance, it complains if I
\type in 'rm -rf *', since 'mv' doesn't have the -r flag and also can't move
\across file partitions.
How about the following csh hacks?
You needn't use the `-rf' flags anymore, just type `rm directory'!
alias rm 'set r=(\!* /); _rm'
alias _rm 'if ($#r > 1) eval /bin/mv $r[1] ~/tmp \|\|'\
'/bin/cp -r $r[1] ~/tmp \&\& /bin/rm -r $r[1]\; shift r\; _rm'
--
George Bush: |Maarten Litmaath @ VU Amsterdam:
Capt. Slip of the Tongue |maart at cs.vu.nl, mcvax!botter!maart
More information about the Comp.unix.questions
mailing list