title: Bash Shell Scripting: How to Sum the Values in a File With the Use of For Loop and bc Command
body: <p>I'm currently trying to write a function in my bash script that does the following: Take in a file as an argument and calculate the sum of the numbers within that file. I must make use of a for loop and the bc command. </p>
  
  <p>Example of values in the file (each value on their own line):</p>
  
  <pre><code>12
  4
  53
  19
  6
  </code></pre>
  
  <p>So here's what I have so far:</p>
  
  <pre><code>function sum_values() {
    for line in $1; do
    #not sure how to sum the values using bc
    done
  }
  </code></pre>
  
  <p>Am I on the right track? I'm not sure how to implement the bc command  in this situation.</p>