prompt before doing rm command
# safe rm
function rm {
if [ $BASH ]; then
REDB=`echo -e "\e[;41m"`
PURPLEB=`echo -e "\e[;45m"`
NORM=`echo -e "\e[m"`
else
REDB="\033[0;41m"
PURPLEB="\033[0;45m"
NORM="\033[0m"
fi
echo "Your current directory is : ${PURPLEB}$PWD${NORM}"
echo "You are about to do the following: ${REDB}$(which rm) $@${NORM}"
echo "Are you sure ('yes' to proceed)?"
read sure
if [ "$sure" == "yes" ]; then
$(which rm) $@
else
echo Cancelled.
fi
}
'Unix/Linux' 카테고리의 다른 글
How to disable telnet on solaris (0) | 2012.07.19 |
---|---|
How do I find out what shell I’m using? (0) | 2012.07.18 |
On Ubuntu `sudo halt` doesn't poweroff the box (0) | 2012.07.15 |
Cygwin SSHD HowTo (On Windows) (0) | 2012.07.13 |
Bash For Loop Examples (0) | 2012.06.28 |