title: How do I redirect string input into sudo?
body: <p>I'm writing a bash script that requires root access and so what I need to do is write something like</p>
  
  <pre><code>$my_psswd &gt;&gt; sudo some_command parameter1 parameter2
  </code></pre>
  
  <p>to automate the process. I'm not concerned if this opens up security holes. This is more or less of an example that I can think of. But the problem is that when I initiate sudo anything, it asks for user input which I'm not sure how automate or provide as a variable.</p>
  
  <p>I've tried things like</p>
  
  <pre><code>$my_psswd &gt;1 sudo something
  echo $my_psswd | sudo something
  </code></pre>
  
  <p>but none of this is what I want. Also this has to be a bash script, I can't use a program like expect. Thanks.</p>