Weigun->Linuxer->嘻嘻weigun.blog.chinaunix.net
wfnh
全部博文(28)
2011年(3)
2010年(6)
2009年(7)
2008年(12)
jiannma
猪大哥
大鬼不动
珞水的大
matoohao
luufoo
x9x9
scriptsh
consenmy
L_WC
eyangbo
d4rkl0rd
t3581431
y6cmE
scanme
zhida7
分类: LINUX
2008-11-30 17:01:51
#!/usr/bin/perl -wuse strict;die "Permission denied:Perhaps need root\n" if `whoami`!~/root/; my @all_image=split("\n",`dpkg --get-selections | grep 'linux-' | grep -v 'deinstall'`);my @old_image;foreach(@all_image){ if($_=~s[(linux-image-\d\.\d\.\d{2}-\d{1,2}-generic).*][$1]i) { push(@old_image,$_); }}my $i;my $choose;while(1){ $i=0; foreach(@old_image) { print ++$i,'.',$_,"\n"; }print "please choose image which you want to delete:(0 for quit)";chomp($choose=<STDIN>);if($choose==0){ exit(0);}elsif($choose>@old_image){ print "\nERROR:Unavailable Selection\n"; next;}last;}`apt-get remove $old_image[--$choose] -y`||die "\n";
上一篇:glade3 画有图片&&lable的按钮
下一篇:一个集一些优化和设置的脚本
登录 注册