2 u010376788 u010376788 于 2014.11.22 15:04 提问

Ubuntu21.0.4LTS中下面脚本为什么只执行if,而不执行elii

#!/bin/bash
#Program:

It is similar with sh06_if.sh.

#History:
#2014/11/21 Wang Zhiming First release
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH

read -p "Please input (Y/N):" yn
echo $yn

if [ "$yn"=="Y" ] || [ "$yn" == "y" ]; then
echo "OK, continue"
elif [ "$yn"=="N" ] || [ "$yn" == "n" ]; then
echo "Oh, interrupt"
else
echo "I don't know what your choice is"
fi

1个回答

save4me
save4me   Ds   Rxr 2014.11.22 15:56

使用[[]]替换[]

u010376788
u010376788 行不通啊
大约 3 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!