Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/28.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 无法将布尔值指定给bash中的变量?_Linux_Bash_Shell_Unix - Fatal编程技术网

Linux 无法将布尔值指定给bash中的变量?

Linux 无法将布尔值指定给bash中的变量?,linux,bash,shell,unix,Linux,Bash,Shell,Unix,我已将$weMountedBoot设置为false,就像脚本开头所示: weMountedBoot=false 现在,如果它没有装入,因此条件代码运行,我会得到这个错误,并且变量不是设置为true: ./verifyBootFiles: line 41: false=true: command not found 相关代码: if ! mount | grep "/boot" > /dev/null then sudo mount -r -U $toCheck $

我已将
$weMountedBoot
设置为false,就像脚本开头所示:

weMountedBoot=false
现在,如果它没有装入,因此条件代码运行,我会得到这个错误,并且变量不是设置为true:

./verifyBootFiles: line 41: false=true: command not found
相关代码:

if ! mount | grep "/boot" > /dev/null

   then

      sudo mount -r -U $toCheck $mountPoint
      $weMountedBoot=true

   fi

怎么了?你可能认为我真的很喜欢shell脚本,而且有丰富的经验。。。因此,关于代码的任何其他注释都是受欢迎的。

只需删除前导的
$


$weMountedBoot=true
将是
weMountedBoot=true

记住向上投票并选择最佳答案。很遗憾,投票需要15次代表。。。但我会记得。。。