# .bashrc
# User specific aliases and functions
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
OR emulate a recycle bin
#mkdir ~/recycle
#in .bashrc, alias mv='my_mv'
Save this file as "my_rm" in one of your PATH directories (/usr/local/bin is an appropriate place for it). Then chmod 700 my_rm, so it can be executed. Basically, you're setting things up so that whenever you say "rm FILE(S)" you actually do "mv FILE(S) ~/recycle". Feel free to modify this at your leisure.
#!/bin/sh
# This is a substitute for rm that moves deleted files to a recycle bin
RECYCLE="$HOME"/recycle
CURRENTDIR=`pwd`
for file in "$CURRENTDIR"/$*
do mv "$file" "$RECYCLE"
done
exit 0
0 意見:
Post a Comment