I'm testing out some bash code and getting errors as I'm reading the final row of file and comparing it to another:
#!/bin/bash
NEW_EVENT_TAIL=`echo tail -1 new_events.txt`
EXISTING_EVENT_TAIL=`echo tail -1 new_events.txt`
if ["$NEW_EVENT_TAIL"="$EXISTING_EVENT_TAIL"];
then
echo "in list"
else
echo "not in list"
fi
Based on this code, and using the exact same file, I would expect the "in list" to be printed. Instead, the "not in list" is printed. The message I get:
-bash: [tail -1 new_events.txt=tail -1 new_events.txt]: command not found