title: Bash - How to read content of file into variable, the file was read from key->value property file?
body: <p>I have one key->value property file (my.prop) with such a content:</p>
  
  <pre><code>ROOT_PATH = /opt/user1/
  REL_PATH = data/folder1/
  CONF_FILENAME = my.conf
  </code></pre>
  
  <p>In my bash script I simply read this file, like this:</p>
  
  <pre><code>#!/bin/bash
  PROP_FILE='my.prop'
  ROOT_PATH =''
  REL_PATH=''
  CONF_FILENAME=''
  
  while read -r key eq value; do
      case $key in
        "ROOT_PATH") 
          ROOT_PATH=${value}
        ;;
      case $key in
        "REL_PATH") 
          REL_PATH=${value}
        ;;
      case $key in
        "CONF_FILENAME") 
          CONF_FILENAME=${value}
        ;;
      esac
  done &lt; $PROP_FILE
  </code></pre>
  
  <p>After that I would like to form the path to <em>my.conf</em> file and read its content to some variable, like this:</p>
  
  <pre><code>CONF_FULL_PATH=$ROOT_PATH$REL_PATH$CONF_FILENAME
  CONF_FILE_CONTENT=`cat ${CONF_FULL_PATH}`
  </code></pre>
  
  <p>If I print out <code>CONF_FULL_PATH</code> variable it will have some trash inside (parts of all three sub paths). 
  And at this line<code>CONF_FILE_CONTENT=`cat ${CONF_FULL_PATH}`</code> I will have this error message - <em>: No such file or directoryta/folder1/</em></p>
  
  <p>So, my question is, how could I properly form the path to <em>my.conf</em> file and put its content to some specific variable? I already tried <code>source</code> command as a replacement for while loop. Also to build a proper path string I've used this statements:
  <code>$(dirname $ROOT_PATH)/$(dirname REL_PATH)/$(basename $CONF_FILENAME)</code> but this looks odd for my point of view.</p>
  
  <p>Any help would be great!</p>