问题描述
- 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 PATHread -p "Please input (Y/N):" yn
echo $ynif [ "$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
解决方案
使用[[]]替换[]
时间: 2024-09-29 00:02:37