我想检查所有三个变量是否相同,然后打印消息
if [ "$x1" == "$x2" == "$3" ];
then
echo "all are same"
fi
我收到此错误:
最佳答案
您当时无法比较三个变量。而是以两个为单位比较它们:
if [ "$x1" = "$x2" ] && [ "$x2" = "$x3" ];
then
echo "all are same"
fi
关于bash - unix shell脚本,用于检查三个变量是否相同,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/22039200/