This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Linux / UNIX and the fly likes Executing JAVA code from shell script and grep the result Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Executing JAVA code from shell script and grep the result" Watch "Executing JAVA code from shell script and grep the result" New topic
Author

Executing JAVA code from shell script and grep the result

P B Madhavan
Greenhorn

Joined: Dec 23, 2009
Posts: 5
Hi All,

I am new to Unix. I have a question

I have a requirement to execute a JAVA class from Unix shell script.

I need to then grep for a key word "NOTOK" that is rendered by a System.out.println statement of the JAVA Class.

If I find the word, then I need to echo a message.

Could you kindly help me with this requirement?


Regards,

Madhavan
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16019
    
  20

java my.app.MainClass | grep NOTOK && echo "something"

Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Executing JAVA code from shell script and grep the result