title: bash set -x and stream
body: <p>Can you explain the output of the following test script to me:</p>
  
  <pre><code># prepare test data
  echo "any content" &gt; myfile
  
  # set bash to inform me about the commands used
  set -x
  
  cat &lt; myfile
  </code></pre>
  
  <p>output:</p>
  
  <pre><code>+cat
  any content
  </code></pre>
  
  <p>Namely why does the line starting with + not show the "&lt; myfile" bit?</p>
  
  <p>How to force bash to do that. I need to inform the user of my script's doings as in:</p>
  
  <pre><code>mysql -uroot &lt; the_new_file_with_a_telling_name.sql
  </code></pre>
  
  <p>and I can't.</p>
  
  <p><strong>EDIT</strong>: additional context: I use variables. Original code:</p>
  
  <pre><code>SQL_FILE=`ls -t $BACKUP_DIR/default_db* | head -n 1` # get latest db
  mysql -uroot mydatabase &lt; ${SQL_FILE}
  </code></pre>
  
  <p><code>-v</code> won't expand variables and <code>cat file.sql | mysql</code> will produce two lines:</p>
  
  <pre><code>+mysql
  +cat file.sql
  </code></pre>
  
  <p>so neither does the trick.</p>