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
Where the arguement passed to the testrmscript is the file to be
deleted.For eg. testrm2 is the file to be deleted.
Now,i run the above script as follows:
./testrmscript testrm2
It prompts me for deletion of the file.If i say "n" which means a value
more than 0, it exits as expected.
But,if i say "y" i.e. value of 0,it removes the file before copying it.
Here,what i see the reason ,is that rm deletes the file before copy
takes place.
Can i interfere with rm prior to it performing the action?
If this works,i can put this script in my .bash_profile and it'll be
great.
Any comments/suggestions would be great!
Cheerio,
Vineeta
_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list