alias rm /bin/delDon't forget to 'source .cshrc' after your edit.
This script simply moves the file you're wanting to delete to /tmp, and/or names duplicate files as /tmp/filename+datestamp. That way, if you realize that you've deleted a file that you need after all, you can retrieve it safely from /tmp.
#!/bin/tcsh[Editor's note: Save the file, make it executable (chmod 755 filename), type 'rehash' to force the shell to find it, and you're good to go. Remember to create an alias for 'rm' if you want this new command to override the old, and I'd recommend keeping it in ~/bin or /usr/local/bin, just to protect it from future upgrades.]
# del Moves the argument to directory /tmp instead of removing it.
# Bumps old version in tmp to /tmp/$FILE+$stamp if it exists.
setenv stamp `date | awk '{print $2"_"$3"_"$4}'`
echo "Moving files(s) to the trash ..."
foreach FILE ($*)
if ( ! -f $FILE ) then # if not file or directory
if (! -d $FILE ) then
echo "$FILE not found"
exit
endif
endif
if (-f /tmp/$FILE) then
echo " * File /tmp/$FILE exists. "
echo " * Bump it to /tmp/$FILE+$stamp."
mv /tmp/$FILE /tmp/$FILE+$stamp
else if ( -d /tmp/$FILE) then
echo " * Directory /tmp/$FILE exists. "
echo " * Bump it to /tmp/$FILE+$stamp."
cp -r /tmp/$FILE /tmp/$FILE+$stamp
rm -r /tmp/$FILE
endif
mv $FILE /tmp
echo "$FILE moved to /tmp ..."
end

