title: Bash compare two dates
body: <p>Trying to figure out how to compare two dates to determinate which is major,
  The format is week's days, hour, minute, disposed into 3 variables.</p>
  <p>INPUT EXAMPLE TEXT FILE WITH THE MAXIMUM VALUE</p>
  <pre><code>7
  23
  59
  </code></pre>
  <p>THE BASH</p>
  <pre><code>#!/bin/bash
  #CHECKTIME
  
  {
     IFS= read -r d
     IFS= read -r h
     IFS= read -r m
  } &lt; myFile.txt
  
  echo schedule time:
  echo $d
  echo $h
  echo $m
  
  
  #GET TIME
  IFS=- read -r DAY HOUR MINUTE &lt; &lt;(date +%u-%H-%M)
  echo current time:
  echo $DAY
  echo $HOUR
  echo $MINUTE
  
  
  if [ &quot;$DAY&quot; &gt;= &quot;$d&quot; ] &amp;&amp; [ &quot;$HOUR&quot; &gt;= &quot;$h&quot; ]
  #if ((&quot;$DAY&quot; = &quot;$d&quot;))
  then
      echo &quot;do event&quot;
  
  else
          echo &quot;don't do event&quot;
  fi
  </code></pre>