title: undefined variable using a shell variable in a ssh command
body: <p>I'm fairly new to bash script and probably won't do this often. I have the below script to check latest updates at a certain location, but I'm getting:
  <code>location: Undefined variable</code> and the timestamp is not retrieved successfully.</p>
  
  <pre><code>#!/bin/bash
  
  servers=('x' 'y')
  results=()
  location="/path/to/location/"
  
  for server in "${servers[@]}"; do   
      output=$(ssh "$server" 'find "${location}" -exec stat \{} --printf="%y\n" \; | sort -n -r | head -n 1')
      x=(${server}:${output})
      results+=(${x})
  done
  
  echo "Printing results..."
  for res in "${results[@]}"; do
      echo "$res"
  done
  </code></pre>
  
  <p>My goal is to print at the end:</p>
  
  <pre><code>x:&lt;timestamp of last update&gt;
  y:&lt;timestamp of last update&gt;
  </code></pre>
  
  <p>I'm wondering what's wrong.</p>