Hi, Y.. Well, remember that he's only 2, and what 2-year-olds want most out of life is attention. Even though he's getting negative attention for saying "shut up," it's still attention. You have to short-circuit this vicious cycle somehow.
Make sure that he's getting lots of attention for all the other words he says, lots of praise for how well he says everything else. Teach him some songs or even prayers, and keep him busy so that he won't need to shout out for attention as much. Also, when you do need to discipline him for saying the bad words, don't make a big deal of it. Don't show your frustration. "Oh, well, you said the naughty words again, so it's timeou for you."
Make sure YOU don't tell anyone else to shut up, either, and don't invite ppl into your house who talk that way, either. Boys his age are hungry for male role models, and if the older boys and men around him all say "shut up," then he's going to believe that's how boys talk, and he'll continue to defy you because he needs desperately to act like a male. That urge is much stronger at his age than his need to please you; during the terrible twos, kids have virtually NO need at all to please their parents. They need to feel smart and powerful; they need to act like their gender, male or female. That's probably what he's asserting right now.
And be patient; he's only 2. Just because he's got a bad habit at this age isn't a sign that he's a bad kid. He's just a little confused.
Peace,
Syl