下午逛V2EX时撞到这个帖子:这样的 install.sh 实在是让人情何以堪
点击链接进去,看粉色的第三行,哈哈,仔细找亮点,
rm -rf /usr /lib/nvidia-current/xorg/xorg
原来是多打了个空格,直接导致/usr目录被删除,看可怜作者的sorry语”
GIANT BUG... causing /usr to be deleted... so sorry.... issue #123, issue #122, issue #121
“
到这里看还不算亮点,看各位楼下的同志们的评语和调侃图吧,这才强大
Hezion:Success!! //站着说话不腰疼的
jschairb:where’s the ‘like’ button? //FB党找like按钮的
flying-sheep:and here is the most commented-on code line on github! //gitbuh史上最多代码评论
manjun:倒霉孩子 //中国人民安慰你
来吧,各种亮图:
注:有bug的软件的名字是bumblebee

恐怖型滴:


有坚决鼓掌的
mm
比较geek的
有点傻
额…欲知更多情况,去原帖围观吧
linux下最好对rm做如下处理,安全性最高
第一种,直接放到shell的配置文件里,zsh为~/.zshrc,bash对应~/.bashrc,比较简单型:
trash()
{
mv $@ ~/.local/share/Trash/files
}
alias trm="rm"
alias rm=“trash”
第二种:来自这里,http://iregex.org/blog/safer-rm-command.html
#safe remove, mv the files to .Trash with unique name
#and log the acction
function rm()
{
trash="$HOME/.Trash"
log="/var/log/trash.log"
stamp=`date "+%Y-%m-%d %H:%M:%S"` #current time
while [ -f "$1" ]; do
#remove the possible ending /
file=`echo $1 |sed 's#\/$##' `
pure_filename=`echo $file |awk -F / '{print $NF}' |sed -e "s#^\.##" `
if [ `echo $pure_filename | grep "\." ` ]; then
new_file=` echo $pure_filename |sed -e "s/\([^.]*$\)/$RANDOM.\1/" `
else
new_file="$pure_filename.$RANDOM"
fi
trash_file="$trash/$new_file"
mv "$file" "$trash_file"
if [ -w $log ]; then
echo -e "[$stamp]\t$file\t=>\t[$trash_file]" |tee -a $log
else
echo -e "[$stamp]\t$file\t=>\t[$trash_file]"
fi
shift #increment the loop
done
}
发表在《
发表在《
发表在《
据说还有回复的,说是正好我/usr太臃肿了,感谢它帮我减肥;还有说早就看/usr别扭了,正好帮我清理了
最给力的还是selinux的那个图,好无奈呀。幸好 usr和/之间没有空格……
曾经ubuntu试过 #rm -rf /貌似没效果
[回复]
freetstar
回复:
十月 26th, 2011 at 3:10 下午
@delectate, 那估计sudo rm -rf 可以,哈
[回复]
好吧,我好歹还看的懂rm那个代码哪里多了个空格,对于图片上的英文更多的是看不懂。
[回复]
一直在笑……停不下来了……救命……
[回复]
freetstar
回复:
七月 3rd, 2011 at 7:10 下午
@Don, 笑到明天早上吧。。
[回复]
我使用的是第二种,备份脚本是我自己写的额,好好看还是人家牛B
[回复]
freetstar
回复:
六月 18th, 2011 at 5:30 下午
@walfred, 第二种功能强大..
[回复]
囧啊,邮箱打错了
[回复]
freetstar
回复:
六月 18th, 2011 at 3:06 下午
然后直接跑到我邮箱里的审核邮件了…这个squashfs有啥好处
[回复]
额,这作者自己不测试的么,俺现在搞聪明了,时常将 整个分区打包成squashfs
[回复]
汗~~ 作者估计也很郁闷… 大家都太mean了阿…
[回复]
太可怕了,这是要死人的啊。。。。一般没多少人先读一遍再装的吧。。。
[回复]
freetstar
回复:
六月 18th, 2011 at 10:49 上午
@Terry Chen, 哈哈,这是个大bug
[回复]
wtf,这脚本要杀人的
[回复]
freetstar
回复:
六月 18th, 2011 at 10:50 上午
@alpha080, 看mm的表情就知道了
[回复]
rm -rf ./*
少个点儿也很可怕,哈哈~~~
[回复]
freetstar
回复:
六月 18th, 2011 at 10:50 上午
@奶牛, 是阿,
[回复]
wow,真是可怕!!以后要删东西了,先进到usr里~~再rm -rf
[回复]
freetstar
回复:
六月 17th, 2011 at 11:21 下午
进去/usr里边万一再多打个 /怎么办…
[回复]
婉秋
回复:
六月 17th, 2011 at 11:25 下午
@freetstar, 秒杀
[回复]
freetstar
回复:
六月 17th, 2011 at 11:27 下午
@婉秋, 哈哈
[回复]
rm -rf /usr /lib/nvidia-current/xorg/xorg
如果usr后面没有空格是删除/usr/lib/nvidia-current/xorg/xorg这个
好像是多了个空格吧?
[回复]
freetstar
回复:
六月 17th, 2011 at 11:07 下午
@婉秋, 恩..多了个空格,
[回复]
婉秋
回复:
六月 17th, 2011 at 11:09 下午
@freetstar, 那把文章那个改下,里面写着“少了个空格”
[回复]
freetstar
回复:
六月 17th, 2011 at 11:12 下午
@婉秋, tks,girl
[回复]
婉秋
回复:
六月 17th, 2011 at 11:16 下午
@freetstar,
[回复]