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个回答

使用[[]]替换[]

u010376788
GatsbyNewton 行不通啊
接近 5 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!