Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Executing JAVA code from shell script and grep the result

 
P B Madhavan
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 18303
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
java my.app.MainClass | grep NOTOK && echo "something"
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic