aspose file tools*
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
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: 16065
    
  21

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