On busy days, I’d like to run
$ ./configure && make && sudo make install && halt
on the night and go to bed, hoping the application would automatically be installed. But what I see the next day is the screen where sudo asks me for the password. So how could I run sudo with password in one command line, or is there any other method to do this?
Answer
Yes, use the -S
switch which reads the password from STDIN:
$echo <password> | sudo -S <command>
So for your case it would look like this:
$./configure && make && echo <password> | sudo -S make install && halt
of course, replace <password>
with your password.
Attribution
Source : Link , Question Author : Jichao , Answer Author : John T