On Wednesday, March 14, 2001 5:16 PM, Vineeta
[SMTP:[EMAIL PROTECTED]] wrote:
| Hi,
|    I want to copy any file prior to deletion to a dir. called
|    trashdir
| in my home dir.
| I want to achieve this thru' a script.
| In fact i just tried a small script like this:
| 
| cat testrmscript --contents of testrmscript file
| #!/bin/bash
| echo 'Rm script follows..'
| rm -i $1
| #res=$?
| if [ "$?" = "0" ]
| then
| cp $HOME/$1 ./trashdir
| else
| exit 1
| fi

How about this one?

#! /bin/sh
echo Delete file $1 ? 
read tempvar
if test "$tempvar" = "y"; then
        mv $1 ./trashcan
fi

It certainly isn't robust enough but does the work. You could replace $1
with $@ if you want it exactly the way rm works.
--
Prashant TR <[EMAIL PROTECTED]>
Web: http://www.midpec.com/


----------------------------------------------------------------------------------------------------------------------------
The information transmitted is intended only for the person or entity to which it is 
addressed and may contain confidential 
and/or privileged material. Any review, retransmission, dissemination or other use of, 
or taking of any action in reliance upon,
this information by persons or entities other than the intended recipient is 
prohibited. If you received this in error, please 
contact the sender and delete the material from any computer.
----------------------------------------------------------------------------------------------------------------------------



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to