【发布时间】:2018-02-12 08:46:30
【问题描述】:
是否可以从 bash 中的比较中收集“真或假”?不使用“如果”。
示例(让我用另一种语言制作)
x = 1
y = 1
z = x == y
print(z) #Returns true
如果可能的话,它在 bash 中的表现如何?
已解决
x=1
y=1
[[ $x -eq $y ]] && z=true || z=false
echo $z #Returns true
【问题讨论】:
标签: bash comparison comparison-operators