Can't assign a boolean value to a variable in bash?

I have $weMountedBootset to false like this at the beginning of my script:

weMountedBoot=false

Now, if it is not installed and, therefore, the conditional code is executed, I get this error, and the variable is not set to true:

./verifyBootFiles: line 41: false=true: command not found

corresponding code:

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

   then

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

   fi

What happened? Since you probably thought I really like shell scripts and have a lot of experience ... so any other comments about the code are also welcome.

+5
source share
1 answer

Just delete the lead $.

$weMountedBoot=truewill be weMountedBoot=true.

+5
source

All Articles