<?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 Re: IF statement construct in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/if-statement-construct/m-p/5047169#M96056</link>
    <description>Your problem is both a syntactical one and a logical one. First, it is possible that the very thing you are testing (time) could change while doing the test so it's wiser to capture it in a variable and then test the variable.&lt;BR /&gt;&lt;BR /&gt;CURRHR=$(date '+%H')&lt;BR /&gt;if [[ ${CURRHR} -gt 8 &amp;amp;&amp;amp; ${CURRHR} -lt 21 ]]&lt;BR /&gt;  then&lt;BR /&gt;&lt;BR /&gt;  fi&lt;BR /&gt;--- or to use the external test command&lt;BR /&gt;if [ ${CURRHR} -gt 8 -a ${CURRHR} -lt 21 ]&lt;BR /&gt;  then&lt;BR /&gt;&lt;BR /&gt;  fi&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Wed, 16 May 2007 09:54:28 GMT</pubDate>
    <dc:creator>A. Clay Stephenson</dc:creator>
    <dc:date>2007-05-16T09:54:28Z</dc:date>
    <item>
      <title>IF statement construct</title>
      <link>https://community.hpe.com/t5/operating-system-linux/if-statement-construct/m-p/5047168#M96055</link>
      <description>I'm currently looking to edit a if statement within script. &lt;BR /&gt;The current syntax is &lt;BR /&gt;&lt;BR /&gt;if [[ $(date +%H) -gt 8 ]]&lt;BR /&gt;&lt;BR /&gt;so if it is after 08:00 the next statement runs. I want the if statement to say that if its -gt 8 and -lt 21 , how would I oncorporate that ??&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Berd</description>
      <pubDate>Wed, 16 May 2007 09:47:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/if-statement-construct/m-p/5047168#M96055</guid>
      <dc:creator>Berd</dc:creator>
      <dc:date>2007-05-16T09:47:07Z</dc:date>
    </item>
    <item>
      <title>Re: IF statement construct</title>
      <link>https://community.hpe.com/t5/operating-system-linux/if-statement-construct/m-p/5047169#M96056</link>
      <description>Your problem is both a syntactical one and a logical one. First, it is possible that the very thing you are testing (time) could change while doing the test so it's wiser to capture it in a variable and then test the variable.&lt;BR /&gt;&lt;BR /&gt;CURRHR=$(date '+%H')&lt;BR /&gt;if [[ ${CURRHR} -gt 8 &amp;amp;&amp;amp; ${CURRHR} -lt 21 ]]&lt;BR /&gt;  then&lt;BR /&gt;&lt;BR /&gt;  fi&lt;BR /&gt;--- or to use the external test command&lt;BR /&gt;if [ ${CURRHR} -gt 8 -a ${CURRHR} -lt 21 ]&lt;BR /&gt;  then&lt;BR /&gt;&lt;BR /&gt;  fi&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 16 May 2007 09:54:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/if-statement-construct/m-p/5047169#M96056</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2007-05-16T09:54:28Z</dc:date>
    </item>
    <item>
      <title>Re: IF statement construct</title>
      <link>https://community.hpe.com/t5/operating-system-linux/if-statement-construct/m-p/5047170#M96057</link>
      <description>Hi Berd:&lt;BR /&gt;&lt;BR /&gt;# if [[ $(date +%H) -gt 8 &amp;amp;&amp;amp; $(date +%H) -lt 21 ]]&lt;BR /&gt;&lt;BR /&gt;...although it would be better to first capture the hour in a variable to avoid the repetitive call:&lt;BR /&gt;&lt;BR /&gt;# H=$(date +%H)&lt;BR /&gt;# if [[ "${H}" -gt 8 &amp;amp;&amp;amp; "${H}" -lt 11 ]]&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Wed, 16 May 2007 09:55:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/if-statement-construct/m-p/5047170#M96057</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-05-16T09:55:37Z</dc:date>
    </item>
    <item>
      <title>Re: IF statement construct</title>
      <link>https://community.hpe.com/t5/operating-system-linux/if-statement-construct/m-p/5047171#M96058</link>
      <description>Cheers guys for that, I will amend script as suggested.&lt;BR /&gt;&lt;BR /&gt;Berd</description>
      <pubDate>Wed, 16 May 2007 10:07:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/if-statement-construct/m-p/5047171#M96058</guid>
      <dc:creator>Berd</dc:creator>
      <dc:date>2007-05-16T10:07:03Z</dc:date>
    </item>
  </channel>
</rss>

