我试着这样创建bash脚本:
#!/bin/bash
echo "Where are you now?"
read $city
if [[ $city == "Kyiv" ]] && [[ $city == "Berlin" ]] && [[$city == "California"]];
then
case $city in
Kyiv)
echo "Ukraine";;
Berlin)
echo "Germany";;
California)
echo "USA"
esac
else
echo "$city Its not the city"
fi
字符串
并始终输出:
第一个月
我检查了很多文档,但找不到问题。
还有,
尝试使用不带“case”的条件语句:
#!/bin/bash
echo "Where are you now?"
read $city
if [[ $city == "Kyiv" ]]
then
echo "Ukraine"
elif [[ $city == "Berlin" ]]
then
echo "Germany"
elif [[ $city == "California" ]]
then
echo "USA"
else
echo " $city Its not the city"
fi
型
但输出相同:It’s not the city
个
1条答案
按热度按时间vltsax251#
字符串