首页 > 代码库 > shell初学
shell初学
超简单的一段shell代码,查看电脑属性,删除无效安装包,查看天气。FYI
#!/bin/bashecho -e ‘\n‘echo "Hello,`whoami`"echo "-----------------------------------------------------------------------"echo "Now time is:`date`"#wheather infoif [ -e "101020100.html" ];thenrm -f 101020100.htmlwget http://www.weather.com.cn/data/cityinfo/101020100.html -qelsewget http://www.weather.com.cn/data/cityinfo/101020100.html -qfivar=$(cat 101020100.html)#echo "天气信息:" $varecho $var | awk -F ‘"‘ ‘{print $6 " " $14 " ~ " $18 " " $22 " [ " $34 " ] "}‘echo "-----------------------------------------------------------------------"echo -e ‘\n‘echo "-----------------------------------------------------------------------"echo -e "The PC Info:"uname -aecho "-----------------------------------------------------------------------"echo -e ‘\n‘echo "-----------------------------------------------------------------------"echo ‘Shall you clean trash?‘echo "Please input (y\n)"read charif [ $char == ‘y‘ ];then#delete useless install packagesudo apt-get autocleansudo apt-get cleansudo apt-get autoremoveelseecho "You selected no"fiecho "-----------------------------------------------------------------------"echo "Press anykey to exit..."
shell初学
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。