sudo command and how to auto get password
- by user108988
I got a problem that:
I have a file .sh
#!/bin/bash
var=$(zenity --forms --title="T?t gi? v? yêu nhé" \
--text="V? mu?n t?t máy sau bao nhiêu phút n?a" \
--separator="," \
--add-entry="V? di?n s? vào dây")
case $? in
0) sudo shutdown -h $var
;;
1)
exit 0;;
-1)
echo "An unexpected error has occurred."
;;
esac
How can sudo command autofill the password from echo command or a file.
I read about sudo -S options, but i dont know how it works.
Anyone can give an example about it!
Thanks guys