Do a quick exit? I suppose it all depends upon your perception of the danger. We did a week in the Bahamas this fall and pretty well sucked our tanks dry on the hangbar, enjoying the Sharks as they came by.
One's perception of danger can change based on the exhibited behavior of said sharks. Are they lazily circling, simply checking you out? Great, hang out and enjoy! Or are they approaching within arm's length then retreating in a repeated, agitated manner, or doing the "bump and run" as skankpile notes above? Now it's exit time. Pay attention, and use common sense.
If it comes to having to defend from a shark that's aggressively charging, bang them hard in the nose, which is covered with sensitive receptors. A nice big camera housing is your friend here. In the worst case, if you're grabbed, go straight for the eyes if you possibly can, but in any event, fight hard! Don't try the play dead thing. Attacks are rare. Don't "expect" they're going to get aggressive, or they'll sense your uneasiness. Stay calm unless you're really required to take action.