title: Linux shell scripting - assigning tail value to a variable?
body: <p>I'm setting up a shell script that reads the last line of a log file using:</p>
  
  <pre><code>tail -1 "/path/to/gdscript.log"
  </code></pre>
  
  <p>.. which is echo'ing the last line of the script just fine. The last line of the log dictates whether the process succeeded or failed, so I'm trying to run a quick echo as follows (this is the bit I'm failing at):</p>
  
  <pre><code>if [ (tail -1 "/path/to/gdscript.log")  == "Process Complete" ]; then
  echo "Data Transfer OK"
  else
  echo "Data Transfer Failed"
  exit 1
  fi
  </code></pre>
  
  <p>.. but using the script above I'm getting:</p>
  
  <pre><code>./gdscript.sh: line 14: syntax error near unexpected token `tail'
  </code></pre>
  
  <p>Can someone in the know show me how to format the IF gate above so that I can work off the last line of the log file? I'm new to shell scripting and would really appreciate the help.</p>
  
  <p>Thanks,
  Paul G</p>