title: Reading sudo password from a pipe
body: <p>I try to use vi commands in a script, in addition I try to pass sudo password in same script. So I have something like:</p>
  
  <pre><code>echo mypassword | bash -c "echo $'Goappendthis\E:x\n' | sudo vi /etc/test"
  </code></pre>
  
  <p>vi command is successful but it still keeps asking password. How I can do it w/o password so I can run same command for multiple hosts in a script?</p>