my dog learned polymorphism*
The moose likes Linux / UNIX and the fly likes shell script question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "shell script question" Watch "shell script question" New topic
Author

shell script question

Kerry Wilson
Ranch Hand

Joined: Oct 29, 2003
Posts: 254
Want to monitor tomcat shutdown with the following script. However, it is returning '[: too many arguments]'. It works without the '-a $cnt -gt 0' part, but I don't want it to hang indefinitely.



http://www.goodercode.com
SCJP 1.4
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16101
    
  21

Am I missing something here? Without the countdown it shouldn't be hanging indefinitely, it should be looping forever.


Customer surveys are for companies who didn't pay proper attention to begin with.
Kerry Wilson
Ranch Hand

Joined: Oct 29, 2003
Posts: 254
Tim Holloway wrote:Am I missing something here? Without the countdown it shouldn't be hanging indefinitely, it should be looping forever.


yea, I don't want it to loop forever. Just can't figure out why the -a {condition} is not working properly.
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11465
    
  94

I would probably change to compound test commands rather than builtin test commands - just because I find it easier to work with. So something like:



The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16101
    
  21

There may be an operator precedence issue. Try putting the "-z ps" clause in parentheses.
Kerry Wilson
Ranch Hand

Joined: Oct 29, 2003
Posts: 254
Thanks for the help, here is what finally worked...

 
Don't get me started about those stupid light bulbs.
 
subject: shell script question