zoukankan      html  css  js  c++  java
  • linux课后作业1

    本实验6第一题:菜单驱动程序.

    随便进到某个目录,vim driver.sh

    把代码写进去。

    #!/bin/bash
    
    function welcome()
    {       
            echo -e "
    "
            echo "Use one of the following options:"
            echo "P: To display current derectory "
            echo "S: To display the name of running file"
            echo "D: To display today's date and present time"
            echo "L: To see the listing of files in your present working directory"
            echo "W: To see who is logged in"
            echo "Q: To quit this program"
            echo -n "Enter your option and hit:"
            read a
            echo -e "
    "
    }
    welcome
    until [ $a = q -o $a = Q ];
    do
            case "$a" in
            p|P)
            pwd
            welcome
            ;;
            s|S)
            echo "The running file is $0"
            welcome
            ;;
            d|D)
            date
            welcome
            ;;
            l|L)
            ls -a
            welcome
            ;;
            w|W)
            who
            welcome
            ;;
            *)
            echo -n "Sorry,your option is wrong,please enter your option again"
            echo -e "
    "
            read a
            esac
    done
    echo "Thank you for your playing"
    exit 0
           

    #!/bin/bash
    function welcome(){               echo -e " "        echo "Use one of the following options:"        echo "P: To display current derectory "        echo "S: To display the name of running file"        echo "D: To display today's date and present time"        echo "L: To see the listing of files in your present working directory"        echo "W: To see who is logged in"        echo "Q: To quit this program"        echo -n "Enter your option and hit:"        read a        echo -e " "}welcomeuntil [ $a = q -o $a = Q ];do        case "$a" in        p|P)        pwd        welcome        ;;        s|S)        echo "The running file is $0"        welcome        ;;        d|D)        date        welcome        ;;        l|L)        ls -a        welcome        ;;        w|W)        who        welcome        ;;        *)        echo -n "Sorry,your option is wrong,please enter your option again"        echo -e " "        read a        esacdoneecho "Thank you for your playing"exit 0       

  • 相关阅读:
    性能监控(5)–JAVA下的jstat命令
    内存分析工具-MAT(Memory Analyzer Tool)
    性能监控(4)–linux下的pidstat命令
    性能监控(3)–linux下的iostat命令
    性能监控(2)–linux下的vmstat命令
    性能监控(1)--linux下的top命令
    了解java虚拟机—在TALB上分配对象(10)
    了解java虚拟机—G1回收器(9)
    js 长按鼠标左键实现溢出内容左右滚动滚动
    html标签设置contenteditable时,去除粘贴文本自带样式
  • 原文地址:https://www.cnblogs.com/double891/p/8974774.html
Copyright © 2011-2022 走看看