linux实验4-bash1

来源:互联网 发布:启动盘制作工具mac版 编辑:程序博客网 时间:2024/06/07 05:10
#!/bin/bash#set -xvfunction welcome(){        echo "Use one of the following options:"        echo "P: To display current directory"        echo "S: To display the name of runing 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 op}welcomeuntil [ 'expr match "$op" "[Q|q]"'=="0" ]; #注意空格do        case "$op" in        P|p)        pwd        echo ""        welcome        ;;        S|s)        echo "The running file is $0"        echo ""        welcome        ;;        D|d)        date        echo ""        welcome        ;;        L|l)        ls -a        echo ""        welcome        ;;        W|w)        who        echo ""        welcome        ;;        *)        echo -n "Error!Please enter option again:"        read op        esacdoneecho "BYE"exit 0


蛋疼的空格

原创粉丝点击