title: What level of expertise would this interview item suggest? unset foo; echo bar | read foo; echo $foo
body: <p>Imagine that you are preparing for an in-depth technical interview and you are asked to rate your expertise in shell scripting (hypothetically on a scale of one to ten).  Then look at the following shell command line example and answer the questions: <em>What does this do?</em> and <em>Why?</em></p>
  
  <pre><code>unset foo; echo bar | read foo; echo "$foo"
  </code></pre>
  
  <p>What level of expertise would you map to correctly answer this question <strong>for the general case</strong> (not merely for one or another, specific, version of the shell)?</p>
  
  <p>Now imagine that you're given the following example:</p>
  
  <pre><code>cat "$SOMELIST_OF_HOSTS" | while read host; do ssh $host "$some_cmd"; done
  </code></pre>
  
  <p>... and the interviewer explains that this command "doesn't work" and that it seems to only execute the <em>ssh</em> command on  a few of the hosts listed in the (large) file (something like on in every few hundred hostnames, seemingly scattered from among the list).  Naturally he or she asks: <em>Why is it doing that?</em> and <em>How might you fix it?</em></p>
  
  <p>Then rate the level of expertise to which you would map someone who can answer those questions correctly.</p>