title: SH script string concatenation not working
body: <p>I have a bash script I'm writing that is not concatenating a string as expected. I have (in the script) a preset list of folder paths in a single string, separated by a single space. This works great, later on in the script, I can cycle through each folder path as expected.</p>
  
  <p>I am trying to allow the user to enter in an optional list of other folders, and add to the list of paths to check for. Below is my code, and the output of the command:</p>
  
  <pre><code>#!/bin/sh
  MOUNTPOINTS="/ /var /var/moodledata2"   #Set the mount points to check for
  
  while getopts ":dh" opt; do
          case $opt in
                  d)
                          DEBUG=true
                          ;;
                  h)
                          echo USAGE: diskspace \[-d\] \[\/path1 ...\]
                          exit 0
                          ;;
                  \?)
                          echo Incorrect syntax
                          ;;
          esac
          shift $((OPTIND - 1))
  done
  
  if [ "$#" -gt 0 ]; then
          for var in $@; do
                  NEWMOUNTPOINTS .= $var
                  echo "${MOUNTPOINTS} ${var}"
                  echo "${NEWMOUNTPOINTS}"
          done
  fi
  </code></pre>
  
  <p>When running the command...</p>
  
  <pre><code>$ ./dt /home
  ./dt: 22: ./dt: NEWMOUNTPOINTS: not found
  / /var /var/moodledata2 /home
  </code></pre>
  
  <p>I originally tried with <code>MOUNTPOINTS .= ${var}</code> and <code>MOUNTPOINTS .= "${var}"</code>, but they still produce the same error. I thought I could create a new variable, but that didn't work either (as shown above). The rest of the script continues on, but only with the original <code>MOUNTPOINTS</code> at the top; it never changes that, even if I use <code>MOUNTPOINTS .= $var</code>, above.</p>
  
  <p><strong>What can I do to get a dynamic string created with the command line arguments supplied?</strong></p>