title: How can I add numbers in a Bash script?
body: <p>I have this Bash script and I had a problem in line 16.
  How can I take the previous result of line 15 and add
  it to the variable in line 16?</p>
  
  <pre><code>#!/bin/bash
  
  num=0
  metab=0
  
  for ((i=1; i&lt;=2; i++)); do
      for j in `ls output-$i-*`; do
          echo "$j"
  
          metab=$(cat $j|grep EndBuffer|awk '{sum+=$2} END { print sum/120}') (line15)
          num= $num + $metab   (line16)
      done
      echo "$num"
   done
  </code></pre>