linux if elif else fi

linux if elif else fi
1、接收linuxshell控制台输入的字符串参数:
#!/bash/bin
parameter=$1
if [ $parameter = "a" ];then
        echo "equals"
elif [ $parameter = "b" ];then
        echo "not"
else
        echo "kong"
fi
2、接收linuxshell控制台输入的数字参数:
#!/bash/bin
parameter=$1
if [ $parameter = 1 ];then
        echo "input is $parameter"
elif [ $parameter = 2 ];then
        echo "input is $parameter"
else
        echo "input is other: $parameter"
fi


3、接收linuxshell控制台输入的时间参数:











你可能感兴趣的:(linux if elif else fi)