title: Moving a file and adding the date to the filename
body: <pre class="lang-sh prettyprint-override"><code>#!/bin/bash
  while read server &lt;&amp;3; do   #read server names into the while loop    
    if [[ ! $server =~ [^[:space:]] ]] ; then  #empty line exception
      continue
    fi   
    echo "Connecting to - $server"
    #ssh "$server"  #SSH login
    while read updatedfile &lt;&amp;3 &amp;&amp; read oldfile &lt;&amp;4; do     
      echo Comparing $updatedfile with $oldfile
      if diff "$updatedfile" "$oldfile" &gt;/dev/null ; then
        echo The files compared are the same. No changes were made.
      else
        echo The files compared are different.
        # copy the new file and put it in the right location
        # make a back up of the old file and put in right location (time stamp)
        # rm the old file (not the back up)
        #cp -f -v $newfile
  
        # ****************************
        mv $oldfile /home/u0146121/backupfiles/$oldfile_$(date +%F-%T)
        # ****************************
      fi 
    done 3&lt;/home/u0146121/test/newfiles.txt 4&lt;/home/u0146121/test/oldfiles.txt
  done 3&lt;/home/u0146121/test/servers.txt
  </code></pre>
  
  <p>The line between <code>*</code> is where I am having trouble with my script. It would output the file with both the date and filename. It just uses the date. I want it to do both.</p>