Bash script to automatically give an interactive value to prompt.
For instance, you need to execute a sudo command on user logon, and you need to do it through a script.
Edit a bash script with the following content:
( echo 'P4ssw0rd
' ) | su - root -c "/sbin/rcnetwork restart"
P4ssw0rd is the password for root user
"/sbin/rcnetwork restart" is the command to execute as root user
Take special attention on the new line after the password on the bash script, and also on the single quotes.
This is only for reference, you never should write out the root password on a plain text file.