Linux 命令行下解决rm误删除问题 (支持mac)
作者:
onefishum | 来源:发表于
2016-11-30 13:59 被阅读54次alias rm=trash
trash()
{
files=()
timestamp=$(date +%s)
for file in "$@"
do
if [[ ${file:0:1} != "-" ]]
then
files=("${files[@]}" "${file}")
fi
done
mkdir -p ~/.trash/$timestamp
echo `date -r $timestamp '+%x %X'` " $timestamp: rm $* --> mv "${files[@]}" --> source: `pwd`" >> ~/.trash/.trash.log
mv "${files[@]}" ~/.trash/$timestamp
}
http://51strive.com/doc/201611301306.html
本文标题:Linux 命令行下解决rm误删除问题 (支持mac)
本文链接:https://www.haomeiwen.com/subject/iwhtmttx.html
网友评论