title: Bash using source to load config file
body: <p>I need to use a configuration file (which simply has some variable settings) which will be used by the sh script. I'm using source to do it, like so:</p>
  
  <p>cmd.config file:</p>
  
  <pre><code>CUSTOM_JAVA_HOME=
  JAVA_FLAGS=-server -Xmx2048M
  </code></pre>
  
  <p>program.sh file:</p>
  
  <pre><code>#!/bin/sh
  if [ -f "cmd.config" ]; then
      source "cmd.config"
  fi
  
  [ -z "$CUSTOM_JAVA_HOME" ] &amp;&amp; JAVA_BIN="java" || JAVA_BIN="$CUSTOM_JAVA_HOME""/bin/java"
  </code></pre>
  
  <p>The idea is to load the file only if it exists and then use those variables.</p>
  
  <p>However I always get:</p>
  
  <blockquote>
    <p>xxxx@ubuntu:~/Desktop/program$ ./program.sh live
    ./program.sh: 3: ./program.sh: source: not found</p>
  </blockquote>
  
  <p>then the program starts using the defaults (cmd.config is not loaded).</p>
  
  <p>Am I missing something?</p>