files recovery after rm?

Ben Lotto ben at nsf1.mth.msu.edu
Fri Nov 10 02:31:12 AEST 1989


>>>>> On 9 Nov 89 01:08:17 GMT, yahoo at unix.cis.pitt.edu (Kenneth L Moore) said:

Kenneth> I use the following aliases in my .tshrc and .cshrc

Kenneth>     alias rm 'mv -f \!:* /tmp' alias unrm 'mv /tmp/\!:* .'

Kenneth> Note that \!:* allows for the use of variable names.

By the way, the \!:* is not sound for the unrm command.  If you tried
'unrm a b c', it would execute 'mv /tmp/a b c .'.  Perhaps some sort of
for loop would work?

Here's what I use.  It's similar to the above.  In my .login file:

	setenv	RMDIR .RM$$
	mkdir $HOME/$RMDIR
	chmod 700 $HOME/$RMDIR

In .cshrc:

	alias	rm	'mv \!* $HOME/$RMDIR'
	alias	unrm	'mv $HOME/$RMDIR/\!$ .'

And in .logout:

	find /home/brain/ben/.RM* -prune \
	-atime +1 -exec /bin/rm -rf {} \; >>& $HOME/LOGOUT.log &

The advantages of this over the other method: every login shell gets its
own removal directory, the removal directories are private, there is no
clash between users if many users are using the same methods.

The disadvantages: disk space gets charged to you.

Question 1: what are the other advantages and disadvantages of these
approaches?

Question 2: is there any difference between \!* and \!:*?


--

-B. A. Lotto  (ben at nsf1.mth.msu.edu)
Department of Mathematics/Michigan State University/East Lansing, MI  48824



More information about the Comp.unix.questions mailing list