Why "Merde!" means good luck
During the 19th century in France, well-to-do spectators arriving to a theatrical performance would generally be dropped off by horse and buggy where the horses, being horses, would naturally do their thing in front of the theater.
A large accumulation of merde on the street (that would inevitably get tracked into the playhouse) was synonymous with a larger audience, and was said to be a sign of the show's success. And because the superstition of wishing actors good luck before a play was thought to bring about misfortune, "merde!" eventually became the customary expression for "good luck!".
So the next time someone slings a "merde!" at you before you go for that job interview or important exam, there's no need to take offense. And remember not to thank them, unless you don't believe in thespian superstition.