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
The screenshot of commands.
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
if [ ! -n "$IS_WINDOWS" ] then /bin/su root -c "...." fi