It was flying a HUGE US flag, hailing the attacking planes on all frequencies, including pre-arranged US-Israel frequencies, and had men on the deck trying to wave them off. We identified those tiny little specs in the sky as Israeli ... do you suppose the Israeli were the sight impaired with that large ship?
The Egyptions had no ship even closely resembling the Liberty. Israeli pilots are well trained and well briefed before making an attack.
Do your homework.
Just because the ship displayed an American flag doesn’t necessarily indicate that it was American. During World Wars I and II, ships, especially those of the Central and Axis powers, often flew flags of countries other than their own.
In any case, it is safe to assume that had the ship not been hanging around in the middle of a war zone, it would not have been attacked.