I'm trying to compare the contents of two files in a bash script.
local_file=$(cat my_local_file.txt)
remote_file=$(curl -s "http://example.com/remote-file.txt")
if [ local_file == remote_file ]; then
echo "Files are the same"
else
echo "Files are different. Here is the diff:"
diff <(echo "$local_file") <(echo "$remote_file")
fi
When I run the script, I see that I have a syntax error:
./bin/check_files.sh: line 8: syntax error near unexpected token `('
./bin/check_files.sh: line 8: ` diff <(echo "$local_file") <(echo "$remote_file")'
What am I doing wrong? How can I display a diff of these two strings from a bash script?