linux shell脚本学习

命令好麻烦,艰苦啊,任重而道远~~~


多重判定,为了理顺自己的逻辑关系~~~


#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
read -p "qing shu ru Y/N:" yn
if [ "$yn" == "Y" ];then
        echo "okY"
else
        if [ "$yn" == "y" ];then
        echo "oky"
        else
                if [ "$yn" == "N" ];then
                echo "NON"
                else
                        if [ "$yn" == "n" ];then
                        echo "NOn"
                        else
                                echo "I don't know what your choice is" && exit 0
                        exit 0
                        fi
                exit 0
                fi
        exit 0
        fi
        exit 0
fi

输入Y 输出okY

输入y 输出oky

输入N 输出NON

输入n 输出NOn

其实有更简单的办法,晚上再写。

今天晚上重新搭建环境,从安装系统开始~!

你可能感兴趣的:(linux)