how to Install jdk.bin using shell script with auto yes/no?

#!/bin/sh
echo "Installing Java!!!"
cd /opt
echo "Want to give execute Permissions to java!!!"
chmod 755 jdk-6u7-linux-i586.bin
echo "Executing the jdk script"
./jdk-6u7-linux-i586.bin

This is the shell commands I am using...
I want to know how to give answer to yes and no automatically here when shell ask
Do you agree to the above license terms? [yes or no]

Please guide me on this

Thanks in advance

Regards
Sandeep

Hi.

Did you try:

yes | ./jdk-6u7-linux-i586.bin

for yes, and

yes no | ./jdk-6u7-linux-i586.bin

for no?

Thanks buddy its working.... but how can I bypass the licence terns which i used to press Q before Yes or no....

Thanks in advance

Regards
Sandeep

Hi.

Try something like:

printf "Q\nyes\n" | ./jdk-6u7-linux-i586.bin

no friend i tried various options but it was not working is it Q only?

---------- Post updated 08-06-09 at 05:10 AM ---------- Previous update was 08-05-09 at 09:19 AM ----------

If some can bypass the licence terms by automatically acceptin "Q" in jdk installation?

wget -Nc "http://dl8-cdn-03.sun.com/s/ESD6/JSCDL/jdk/6u16-b01/jre-6u16-linux-i586-rpm.bin?e=1252519776961&h=7bc60c46c5cf39e4dafc2a5e2de02050/&filename=jre-6u16-linux-i586-rpm.bin" -O jre-6u16-linux-i586-rpm.bin

chmod +x jre-6u16-linux-i586-rpm.bin

sed -i 's/agreed=/agreed=1/g' jre-6u16-linux-i586-rpm.bin
sed -i 's/more <<"EOF"/cat <<"EOF"/g' jre-6u16-linux-i586-rpm.bin

./jre-6u16-linux-i586-rpm.bin

rpm -Uvh jre-6u16-linux-i586.rpm 2> /dev/null

# Plugin-for Firefox 3.5.2 on Fedora 11
/sbin/ldconfig

ln -s /usr/java/default/plugin/i386/ns7/libjavaplugin_oji.so /usr/lib/mozilla/plugins/libjavaplugin.so

rm -f jre-6u16-linux-i586.rpm jre-6u16-linux-i586-rpm.bin

using the following command able to install silently in local machine,

echo "yes" | ./jdk_version.bin &>/dev/null

but can anybody help me how to do in remote machine . i am trying the below command but it is not working,
ssh root@ipaddress_of_remotemachine echo "yes" | ./jdk_version.bin &>/dev/null