当我运行这个脚本时,我会得到以下错误。我在这里做错什么了?任何帮助,谢谢-巴什新手
错误:
line 12: 0=1: command not found
line 13: 0=1: command not found我的剧本:
count_raw=0
avg_raw=0
$count_raw=1
$avg_raw=1
echo "count_raw=$count_raw"
echo "avg_raw=$avg_raw"发布于 2015-07-24 05:14:32
=是一个赋值运算符,当被找到时,$保存变量的值(不仅在美国,也在bash中)。
因此,当您说:$var=1时,您实际上是在bash中键入一个随机字符串(在您的例子中是0=1),而bash不喜欢这样做。请看下面的一行代码,其中显示了输入$var=1和bash就可以处理它的一个例子:
var=1; if [[ $var=1 ]]; then printf "Congrats! You have learned the difference between variable assignment and variable comparison in the ${var}st attempt.\n"; fi;https://stackoverflow.com/questions/31584620
复制相似问题