title: Extract value from file for input into IF Statement
body: <p>I have a config.txt file where the first line has a number 1, I need to read this and do certain tasks based on whether the number is 1 or 2 or 3 etc</p>
  
  <p>The problem is I cannot test that config value, none of the if statements below work, and I tried many more variances.</p>
  
  <pre><code>config=$(head -n 1 /mnt/writable/config.txt)    #grabs vale from file
  echo $config        #prints 1
  </code></pre>
  
  <p>But the following if statements do not echo anything.</p>
  
  <pre><code>if [[ "$config" = "1" ]];
  then
    echo "is a 1";
  fi
  
  if [[ "$config" == "1" ]];
  then
    echo "is a 1";
  fi
  
  if [[ "$config" = 1 ]];
  then
    echo "is a 1";
  fi
  
  if [ $config = 1 ];
  then
    echo "is a 1";
  fi
  </code></pre>
  
  <p>I also tried "declare -i config" at the top but that didnt work either. Spent a day and no luck so far. </p>