title: Using sudo with for loop
body: <p>I want to run a simple for loop command with sudo, but it isn't working:</p>
  
  <pre><code>sudo -i -u user for i in /dir; do echo $i; done
  </code></pre>
  
  <p>I get the following error:</p>
  
  <pre><code>-bash: syntax error near unexpected token `do'
  </code></pre>
  
  <p>Probably a very simple thing I am overlooking.  Any help?</p>