<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none"><!--P{margin-top:0;margin-bottom:0;} .ms-cui-menu {background-color:#ffffff;border:1px rgb(171, 171, 171) solid;font-family:"Segoe UI WPC","Segoe UI",Tahoma,"Microsoft Sans Serif",Verdana,sans-serif;font-size:12pt;color:rgb(51, 51, 51);} .ms-cui-menusection-title {display:none;} .ms-cui-ctl {vertical-align:text-top;text-decoration:none;color:rgb(51, 51, 51);} .ms-cui-ctl-on {background-color:rgb(223, 237, 250);opacity: 0.8;} .ms-cui-img-cont-float {display:inline-block;margin-top:2px} .ms-cui-smenu-inner {padding-top:0px;} .ms-owa-paste-option-icon {margin: 2px 4px 0px 4px;vertical-align:sub;padding-bottom: 2px;display:inline-block;} .ms-rtePasteFlyout-option:hover {background-color:rgb(223, 237, 250) !important;opacity:1 !important;} .ms-rtePasteFlyout-option {padding:8px 4px 8px 4px;outline:none;} .ms-cui-menusection {float:left; width:85px;height:24px;overflow:hidden}--></style>
</head>
<body>
<div style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p> </p>
<p>Hi,</p>
<p> </p>
<p>I am trying to combine a commandline tool (MarZone) with GRASS in a shell script (MSYS in OSGeo4W or Ubuntu).</p>
<p>The MarZone command should run in a loop where it recives new input from GRASS in each iteration.</p>
<p>My scripts works in principle, however, unlike other command line tools, MarZone does not end when it is done, but one has to press enter to stop.</p>
<p>It ends with "Press return to exit." on screen.</p>
<p>In order to handle this in a loop, I simply kill the process after the time I expect the sofware to run (plus a little time buffer):</p>
<p>Like this:</p>
<p>perl -e 'alarm shift @ARGV; exec @ARGV' 60 ./MarZone_x64.exe</p>
<p> </p>
<p>Unfortunately, this is neither an effient nor a stable solution as the time the software runs can vary quite a bit, depending on some parameter settings.</p>
<p> </p>
<p>My question is, is there a way to somehow catch, that the software is ready (when it prints "Press return to exit."), an kill it then?</p>
<p>Any idea?</p>
<p> </p>
<p>Thanks for helping,</p>
<p>Stefan</p>
</div>
</body>
</html>