title: change user in linux script
body: <p>User x run a script. Now I want to change the user in the script to User y.</p>
  
  <pre><code>#!/bin/sh
  whoami
  echo password | su y
  whoami
  </code></pre>
  
  <p>But I get this:</p>
  
  <pre><code>x
  su: must be run from a terminal
  x
  </code></pre>
  
  <p>Thanks for your help.</p>