title: Issue with backup script creating archive
body: <p>I'm having a bit of an issue with my backup script. It uses a <code>for</code> loop to archive anything within a given directory using <code>tar</code>. It lists the directories perfectly and creates separate archives for each directory how I'd like them to be, but the variable isn't listing the path to the directory to backup. Can anyone give me an idea of how to make sure the variable is populated with the correct information?</p>
  
  <p>Here's the script:</p>
  
  <pre><code>#!/bin/bash
  set -xv
  dirs=$(ls /home/phoenix/testarchive)
  dest="/home/phoenix/backup/"
  archive=".tar.bz2"
  
  clear
  echo "Archiving data..."
  
  for dirs in $dirs
  do
    echo "Archiving $dirs..."
    tar cjf "${dest}${dirs}_$(date +%F)${archive}" $dirs
    echo "Archive complete!!"
  done
  
  echo "All archives created!!"
  echo "Test created archive to ensure validity."
  
  ls -lh $dest
  </code></pre>
  
  <p>And here is my error output:</p>
  
  <pre><code>echo "Archiving data..."
  + echo 'Archiving data...'
  Archiving data...
  
  for dirs in $dirs
  do
    echo "Archiving $dirs..."
    tar cjf "${dest}${dirs}_$(date +%F)${archive}" $dirs
    echo "Archive complete!!"
  done
  + for dirs in $dirs
  + echo 'Archiving folder1...'
  Archiving folder1...
  ++ date +%F
  + tar cjf /home/phoenix/backup/folder1_2017-07-18.tar.bz2 folder1
  tar: folder1: Cannot stat: No such file or directory
  tar: Exiting with failure status due to previous errors
  + echo 'Archive complete!!'
  Archive complete!!
  + for dirs in $dirs
  + echo 'Archiving folder2...'
  Archiving folder2...
  ++ date +%F
  + tar cjf /home/phoenix/backup/folder2_2017-07-18.tar.bz2 folder2
  tar: folder2: Cannot stat: No such file or directory
  tar: Exiting with failure status due to previous errors
  + echo 'Archive complete!!'
  Archive complete!!
  
  echo "All archives created!!"
  + echo 'All archives created!!'
  All archives created!!
  echo "Test created archive to ensure validity."
  + echo 'Test created archive to ensure validity.'
  Test created archive to ensure validity.
  
  ls -lh $dest
  + ls -lh /home/phoenix/backup/
  total 8.0K
  -rw-r--r-- 1 phoenix phoenix 46 Jul 18 13:48 folder1_2017-07-18.tar.bz2
  -rw-r--r-- 1 phoenix phoenix 46 Jul 18 13:48 folder2_2017-07-18.tar.bz2
  </code></pre>
  
  <p>The scripts, like i mentioned, is naming exactly how I want, but the actual data archive isn't getting created. I'm sure <code>ls</code> is the issue but I don't know of any other way to get the desired result...</p>