I’m setting up a shell script that reads the last line of a log file using:
tail -1 "/path/to/gdscript.log"
.. 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):
if [ (tail -1 "/path/to/gdscript.log") == "Process Complete" ]; then
echo "Data Transfer OK"
else
echo "Data Transfer Failed"
exit 1
fi
.. but using the script above I’m getting:
./gdscript.sh: line 14: syntax error near unexpected token `tail'
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.
Thanks,
Paul G
To get the output of a command you need
$(cmd...). So I think you mean: