#!/bin/bash
#:set Ff=unix
#:set Nobomb
#-*-Coding:utf-8-*-
######################################################################
# # Filename:Trash.py
##
# # Copyright (C) 2014.6
# # Author: [email protected] @qq. com
##
# # Description:shell Prevent RM-RF Accidental deletion
##
######################################################################
Cat/root/.bash_profile | grep "Trash" &>/dev/null
if [$?-eq 0]# through if The statement determines whether the script has been executed, or if it is executed once, the content is added once
Then
echo "has been done"
Else
Echo-e "
Mkdir-p ~/.trash
Alias Rm=trash
Alias R=trash
Alias rl= ' ls ~/.trash '
Alias Ur=undelfile
function Undelfile ()
{
Mv-i ~/.trash/"\[email protected]".
}
Trash ()
{
MV "\[email protected]"/root/.trash/
} ">>/root/.bash_profile
source/root/.bash_profile #source the document, which took effect
Fi
# the deleted file is in the /root/.trash in
Source: http://iotos.iteye.com/blog/2092948
From for notes (Wiz)