title: Why does a space in a variable assignment give an error in Bash?
body: <pre><code>#!/bin/bash
  
  declare -r NUM1=5
  NUM2 =4                # Line 4
  
  num3=$((NUM1 + NUM2))
  num4=$((NUM1 - NUM2))
  num5=$((NUM1 * NUM2))
  num6=$((NUM1 / NUM2))  # Line 9
  
  echo "$num3"
  echo $((5**2))
  echo $((5%4)) 
  </code></pre>
  
  <p>I am using this bash script, and when I was running the script, I got the error</p>
  
  <pre><code>./bash_help 
  ./bash_help: line 4: NUM2: command not found
  ./bash_help: line 9: NUM1 / NUM2: division by 0 (error token is "NUM2")
  5
  25
  1
  </code></pre>
  
  <p>So I have changed the code to this and the error was gone.</p>
  
  <pre><code>#!/bin/bash
  
  declare -r NUM1=5
  NUM2=4
  
  num3=$((NUM1 + NUM2))
  num4=$((NUM1 - NUM2))
  num5=$((NUM1 * NUM2))
  num6=$((NUM1 / NUM2))
  
  echo "$num3"
  echo $((5**2))
  echo $((5%4)) 
  </code></pre>
  
  <p>Why can't we use spaces when we assign a value to a variable? It is convention to use spaces for better readability of the code. Can anyone explain this?</p>