1、接收l(shuí)inuxshell控制臺(tái)輸入的字符串參數(shù):
3、接收l(shuí)inuxshell控制臺(tái)輸入的時(shí)間參數(shù):
#!/bash/bin
parameter=$1
if [ $parameter = "a" ];then
echo "equals"
elif [ $parameter = "b" ];then
echo "not"
else
echo "kong"
fi
2、接收l(shuí)inuxshell控制臺(tái)輸入的數(shù)字參數(shù):#!/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、接收l(shuí)inuxshell控制臺(tái)輸入的時(shí)間參數(shù):