I am trying to figure out how to get bash to view for any contents in the "the_difference_between_today_and_yesterday.txt" file and then act if there is anything in the file. I thought i had it, but it is not working like I thought. Any ideas?
Code:
if [ -f final_version_$dater.txt ]; then if [ -f final_version_$yester_dater.txt ]; then diff final_version_$dater.txt final_version_$yester_dater.txt | grep "^>" | sed 's/>\ //g' > the_difference_between_today_and_yesterday.txt if grep ^[a-z]* "the_difference_between_today_and_yesterday.txt"; then cp the_difference_between_today_and_yesterday.txt /tmp/24hourlemons_table; mysqlimport --user=USERNAME --password=PASSWORD --columns=name,start_date,end_date,link_url,location \ --fields-terminated-by=':' --lines-terminated-by='\n' carshows /tmp/24hourlemons_table; rm final_version_$three_days_later.txt else echo "There were no differences between the two files"; rm final_version_$three_days_later.txt fi else echo "ERROR! The file of: final_version_$yester_dater.txt does not exist" >> error.log fi fi