Hi
I want to give input automatically by some means... that is i wanna write a script that checks the type of java being installed in the system and should select the appropriate one (for eg, sun's java)

/usr/sbin/alternatives --install /usr/bin/java java /usr/java/jdk1.5.0_14/bin/java 2

usually this command shows the list of java being installed and asks for user input that which java should be selected... the '2' specifies second java to be selected... i want this to be done automatically... among the displayed java i have to select sun java automatically without giving input... based on the result(list of javas) the selection has to be made

Hey There,

Maybe a simpler way, but parsing that execution in perl would make for a really simple pattern match on which you could act:

if ( $whatever =~ /\/usr\/bin\/java$/ )

Hope that helps steer you in the right direction!

, Mike

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.