title: In a bash pipe, take the output of the previous command as a variable to the next command (Eg. if statement)
body: <p>I wanted to write a command to compare the hash of a file. I wrote the below single line command. Wanted to understand as to how I can take the output of the previous command as a variable for the current command, in a pipe. </p>
  
  <p>Eg. below command I wanted to compare the output of 1st command "Calculated hash" to the original hash. In the last command, I wanted to refer to the output of the previous command. How do I do that in the if statement? (Instead of <code>$0</code>)</p>
  
  <pre><code>sha256sum abc.txt | awk '{print $1}' | if [ "$0" = "8237491082roieuwr0r9812734iur" ]; then
      echo "match"
  fi
  </code></pre>