title: Finding max and minimum values from a bash array
body: <p>I have a txt file that has integer values written in it with a ";" separator.
  117;92;16;20;</p>
  
  <p>I need to compare these and select the highest one. 
  My code: </p>
  
  <pre><code>IFS=';' #Internat Field Separator
  read -ra vector&lt;$file
  max=$vector[0]
  min=$vector[0]
  
  for i in ${vector[@]}
  do
  
  if [[ $i &gt; $max ]] ; then
  max=$i
  fi
  
  if [[ $i &lt; $min ]] ; then
  min=$i
  
  fi
  done
  echo "Max value is $max, minimal value is $min"
  break
  </code></pre>
  
  <p>The output is: </p>
  
  <blockquote>
    <p>Max value is 92, minimal value is 16.</p>
  </blockquote>
  
  <p>So of course this is wrong. When I try to echo it:</p>
  
  <pre><code>echo $value ( in a loop of course ) 
  </code></pre>
  
  <p>The output is</p>
  
  <blockquote>
    <p>177[0] 92 16 25</p>
  </blockquote>
  
  <p>Why does the first letter show as int[0]? Because of that I cannot compare them. I can't figure out anything....</p>