This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread 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 Head First Android this week in the Android 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: 16897
    
  26

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

Customer surveys are for companies who didn't pay proper attention to begin with.
 
 
subject: Executing JAVA code from shell script and grep the result
 
It's not a secret anymore!