zoukankan      html  css  js  c++  java
  • shell初学

    超简单的一段shell代码,查看电脑属性,删除无效安装包,查看天气。FYI 

    #!/bin/bash
    echo -e '
    '
    echo "Hello,`whoami`"
    echo "-----------------------------------------------------------------------"
    echo "Now time is:`date`"
    #wheather info
    if [ -e "101020100.html" ];then
    rm -f 101020100.html
    wget http://www.weather.com.cn/data/cityinfo/101020100.html -q
    else
    wget http://www.weather.com.cn/data/cityinfo/101020100.html -q
    fi
    var=$(cat 101020100.html)
    #echo "天气信息:" $var
    echo $var | awk -F '"' '{print $6 "   " $14 " ~ " $18 "   " $22 " [ " $34 " ] "}'
    echo "-----------------------------------------------------------------------"
    echo -e '
    '
    echo "-----------------------------------------------------------------------"
    echo -e "The PC Info:"
    uname -a
    echo "-----------------------------------------------------------------------"
    echo -e '
    '
    echo "-----------------------------------------------------------------------"
    echo 'Shall you clean trash?'
    echo "Please input (y
    )"
    read char
    if [ $char == 'y' ];then
    #delete useless install package
    sudo apt-get autoclean
    sudo apt-get clean
    sudo apt-get autoremove
    else
    echo "You selected no"
    fi
    echo "-----------------------------------------------------------------------"
    echo "Press anykey to exit..."
  • 相关阅读:
    Unique Paths II
    Search Insert Position
    Remove Duplicates from Sorted Array
    Swap Nodes in Pairs
    Merge Two Sorted Lists
    下载youtube 视频工具
    CloudSTack4.2 查看所有虚拟机API测试
    实现业务系统中的用户权限管理--实现篇
    实现业务系统中的用户权限管理--设计篇
    CloudStack4.2 更新全局参数
  • 原文地址:https://www.cnblogs.com/Tiago/p/3984657.html
Copyright © 2011-2022 走看看