#修改rm
#####
alias rm=trash
alias r=trash
alias rl='ls /mdshare/GPU/lost+found'
alias ur=undelfile
undelfile()
{
mv -i /mdshare/GPU/lost+found/\$@ ./
#mv -i ~/.trash/\$@ ./
}
trash()
{
str1=$@ ;
str2=${str1##-* } ; # 只匹配 -rf 等后参数后边的 文件名
mv $str2 /mdshare/GPU/lost+found/$(date +%Y%m%d%H%M%S)_$str2
#在备份文件名前添加日期,防止文件重名覆盖
}
参考:
https://blog.csdn.net/mucaoyx/article/details/95884095
https://windtrack.xyz/post/8ecc0390/