•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Shell Scripting section within the Software Development category of DaniWeb, a massive community of 375,167 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,276 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Shell Scripting advertiser:
Views: 421 | Replies: 1
![]() |
•
•
Join Date: Apr 2008
Posts: 7
Reputation:
Rep Power: 0
Solved Threads: 0
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)
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
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
•
•
Join Date: Oct 2007
Posts: 247
Reputation:
Rep Power: 1
Solved Threads: 26
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
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
Linux and Unix Tips, Tricks and Individual Advice - The Linux and Unix Menagerie!
------------------------------------------------------------------------
Having trouble passing cert exams? Check out How To Pass Any Computer Certification Test!
------------------------------------------------------------------------
Having trouble passing cert exams? Check out How To Pass Any Computer Certification Test!
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb Shell Scripting Marketplace
Similar Threads
- add even (or odd) numbers from input (C++)
- Giving input to a c++ file (Shell Scripting)
- HELP with 2D Arrays Input Files-CrimsonEd/QBasic (Legacy and Other Languages)
- Pls Help JAVA Program Headaches Not Giving me the right output for user input (Java)
- input signal is out of range (Monitors, Displays and Video Cards)
- how do i get more than one checkbox being checked (ASP)
- Need help with programming! (C)
- Input in Java (Java)
Other Threads in the Shell Scripting Forum
- Previous Thread: XML parsing through shell scritps
- Next Thread: CopyRight symbol printing using shell script


Linear Mode