DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/)
-   Shell Scripting (http://www.daniweb.com/forums/forum113.html)
-   -   Giving input (http://www.daniweb.com/forums/thread122662.html)

Raghavansat May 5th, 2008 10:38 pm
Giving input
 
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

eggi May 5th, 2008 10:57 pm
Re: Giving input
 
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


All times are GMT -4. The time now is 12:35 am.

Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC