<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic generating delay based on the counter value in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/generating-delay-based-on-the-counter-value/m-p/3200051#M792504</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I have the following script:&lt;BR /&gt;&lt;BR /&gt;c=1&lt;BR /&gt;while [ $c -le 3000 ]&lt;BR /&gt;do&lt;BR /&gt;cat ${myfile}|while read A B&lt;BR /&gt;do&lt;BR /&gt;"something"&lt;BR /&gt;c=`expr $c + 1`&lt;BR /&gt;echo $c&lt;BR /&gt;done&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;I want to generate 1 sec delay for every 200th count of the counter. Can anyone please help me in accomplishing the task.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Andy&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Mon, 23 Feb 2004 19:15:37 GMT</pubDate>
    <dc:creator>Anand_30</dc:creator>
    <dc:date>2004-02-23T19:15:37Z</dc:date>
    <item>
      <title>generating delay based on the counter value</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/generating-delay-based-on-the-counter-value/m-p/3200051#M792504</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I have the following script:&lt;BR /&gt;&lt;BR /&gt;c=1&lt;BR /&gt;while [ $c -le 3000 ]&lt;BR /&gt;do&lt;BR /&gt;cat ${myfile}|while read A B&lt;BR /&gt;do&lt;BR /&gt;"something"&lt;BR /&gt;c=`expr $c + 1`&lt;BR /&gt;echo $c&lt;BR /&gt;done&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;I want to generate 1 sec delay for every 200th count of the counter. Can anyone please help me in accomplishing the task.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Andy&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 23 Feb 2004 19:15:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/generating-delay-based-on-the-counter-value/m-p/3200051#M792504</guid>
      <dc:creator>Anand_30</dc:creator>
      <dc:date>2004-02-23T19:15:37Z</dc:date>
    </item>
    <item>
      <title>Re: generating delay based on the counter value</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/generating-delay-based-on-the-counter-value/m-p/3200052#M792505</link>
      <description>c=1&lt;BR /&gt;while [ $c -le 3000 ]&lt;BR /&gt;do&lt;BR /&gt;cat ${myfile}|while read A B&lt;BR /&gt;do&lt;BR /&gt;"something"&lt;BR /&gt;c=`expr $c + 1`&lt;BR /&gt;&lt;BR /&gt;if [ $c -eq 200 ] &lt;BR /&gt;then&lt;BR /&gt;  sleep 1&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;echo $c&lt;BR /&gt;done&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;You can reset the counter if you intent is to do that or you can do some division to see if the number is divisible by 200. You you can set a second counter like this.&lt;BR /&gt;&lt;BR /&gt;c=1&lt;BR /&gt;d=1&lt;BR /&gt;while [ $c -le 3000 ]&lt;BR /&gt;do&lt;BR /&gt;cat ${myfile}|while read A B&lt;BR /&gt;do&lt;BR /&gt;"something"&lt;BR /&gt;c=`expr $c + 1`&lt;BR /&gt;d=`expr $d + 1`&lt;BR /&gt;&lt;BR /&gt;if [ $d -eq 200 ] &lt;BR /&gt;then&lt;BR /&gt;  d=1&lt;BR /&gt;  sleep 1&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;echo $c&lt;BR /&gt;done&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Do note that this expression type is considered obsolete:&lt;BR /&gt;&lt;BR /&gt;d=`expr $d + 1`&lt;BR /&gt;&lt;BR /&gt;It should be d=$(expr $d + 1)'&lt;BR /&gt;&lt;BR /&gt;For new scripts.</description>
      <pubDate>Mon, 23 Feb 2004 19:54:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/generating-delay-based-on-the-counter-value/m-p/3200052#M792505</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2004-02-23T19:54:15Z</dc:date>
    </item>
    <item>
      <title>Re: generating delay based on the counter value</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/generating-delay-based-on-the-counter-value/m-p/3200053#M792506</link>
      <description>I've always been fond of the modulus, so how about this:&lt;BR /&gt;&lt;BR /&gt;c=1&lt;BR /&gt;while [ $c -le 3000 ]&lt;BR /&gt;do&lt;BR /&gt;cat ${myfile}|while read A B&lt;BR /&gt;do&lt;BR /&gt;"something"&lt;BR /&gt;c=$(expr $c + 1)&lt;BR /&gt;[ $(expr $c % 200) -eq 0 ] &amp;amp;&amp;amp; sleep 1&lt;BR /&gt;echo $c&lt;BR /&gt;done&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;This way, the sleep only happens when the remainder of $c / 200 is 0.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Seth&lt;BR /&gt;</description>
      <pubDate>Thu, 26 Feb 2004 00:47:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/generating-delay-based-on-the-counter-value/m-p/3200053#M792506</guid>
      <dc:creator>Seth Parker</dc:creator>
      <dc:date>2004-02-26T00:47:46Z</dc:date>
    </item>
  </channel>
</rss>

