lundi 2 mars 2015

provide password for script begin called inside another script [duplicate]



This question already has an answer here:




I have written a shell script which in turn calls another script, but the second one prompts for password. I want to supply the password and pass the prompt without user begin notified.


Here is my script:



su - s3 -c "su.sh"


I trided :



su - s3 -c "echo pass | su.sh"


But I got an error:



standard in must be a tty


Updated:


The screenshot of commands.


enter image description here


I also tired :



su - s3 -c "echo mypass|sudo -S su.sh"


but another error comes up:



sudo: sorry, you must have a tty to run sudo


su.sh commands:



if [ ! -n "$IS_WINDOWS" ]
then
/bin/su root -c "...."
fi


Aucun commentaire:

Enregistrer un commentaire