0

I am running a SSH2 command via PHP and am trying to chain the commands to answer the password prompts from the bash script I run.

wget url-to-bash-script
bash name-of-file.sh

After this it will prompt for

MySQL Password:

And:

Retype password:

It will then proceed to install the packages for LAMP

I have tried something like this with no luck;

$ssh->exec( "wget URL;bash installLAMP.sh; password; password");

Thanks!

1
  • How about "wget URL; printf 'password\npassword\n' | bash installLAMP.sh" Commented May 19, 2013 at 2:01

1 Answer 1

1

What you might want to use is expect

Here are some examples on how to use it:

http://www.thegeekstuff.com/2010/10/expect-examples/

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.