I want to run a command that requires the sudo password say:
sudo apt-get update
Isn't this supposed to work (I have stored the password in a normal text file passwd.txt):
sudo apt-get update <~/passwd.txt
This is my logic for for why it SHOULD work: when the password is required, the user is asked to input the password from the keyboard. But redirecting the stdin to read from the passwd.txt file should work.
Shouldn't it?