title: bash - extract day of week of variable
body: <p>What is the syntax to extract the day of the week from a stored date variable?
  The <code>dateinfile</code> format is always <code>[alphanum]_YYYYMMDD</code>.</p>
  
  <p>In this pseudocode example, trying to get <code>dayofweek</code> to store Saturday:</p>
  
  <pre><code>#! /bin/bash 
  
  dateinfile="P_20090530"
  dayofweek="$dateinfile -u +%A"
  </code></pre>