FROM2= 0;
(ssh machine2 "cat /var/log/syslog* | grep -i \"to=<a@server.com>\" | grep -i sent | grep \"$MONTH \" | cut -c4-6 | grep \" $day_y\" | wc -l") >> $FROM2
echo $FROM2;
FROM2=$(ssh machine2 "cat /var/log/syslog* | grep -i \"to=<a@server.com>\" | grep -i sent | grep \"$MONTH \" | cut -c4-6 | grep \" $day_y\" | wc -l")
echo $FROM2
Did you really want those \?
Did you mean echo or cat?