I've stayed out of this thread because...well, because I know better, but whatever, here goes. I think there are too many general opinions being stated as fact. Like Pelagic said, "If a shark decided to attack you, you are screwed" is not an accurate statement. The thing is though, the result of a shark attack would depend on SO many things. Top of the list would be "how big is the shark?" Two people could be arguing over how dangerous a dog is but if when saying the word "dog" one is imagining a chihuahua and the other a Rottweiler then they are going to have a hard time reaching the same conclusion. Sharks come in lots of shapes and flavors. A guys impression of what it was like being attacked by a 12' Bull shark will be a lot different from another guys experience being bitten by a 5' Blacktip.
Though that would be the main factor, there are countless other questions to ask and without the answers then the original question is too vague to even be considered. What type of shark is it? Is the Shark hungry or curious? Is the shark attacking you or a fish you are holding? Do you see the shark before it attacks? Do you have the knife in your hand before the fish attacks or is it tucked away somewhere? Where does the shark initially bite you? Arm, leg, face or vital organ? One of the most important questions is how scared are you? A fisherman or spear fisherman who is very used to seeing and dealing with sharks will react much more rationally in that scenario. If you are panicking and spazzing out then you'll probably have no more success with a knife than you would flailing around bare handed.
I don't think anyone is completely wrong on this subject, there is truth in everyone's post, but the real answer is "it depends". There are definitely no absolute answers. If you are saying that a knife will always change the outcome of a shark attack then you are definitely mistaken. Try that theory when a White Shark hits you full speed from behind and body parts start flying. If you are saying that a knife is useless in a shark attack then you are definitely mistaken. As Pelagic said, there are numerous stories of people deterring attacking sharks with nothing but their hands and fists. Spear fishermen commonly deal with aggressive sharks with their spear gun and less commonly with a dive knife.
I caught a 5'-6' Whitetip yesterday on the kayak. I brought him in and saw that the circle hook was barely hooked in the corner of the mouth and brought him close to the kayak to try to release him. Rather than trying to control him and remove the hook with pliers, I planned to cut the little piece of skin holding the hook with my caribbean. The shark was thrashing around and head whipping but it wasn't really a nervous affair. I have done this a hundred times and I have a fair bit of familiarity with these fish, and that's all it is...a fish with sharp teeth. You've got to be careful and respectful obviously but it's still just a big ole fish. I can tell you for sure that if that little guy and I were both in the water (both aware of each other) and he had his teeth and I had a knife then he would be the one in trouble, not me. That's not me trying to sound like a sea ninja, that's just reality. If he were a different species of a different size then the story line would change. It just depends.
Anyway, I think I have a quick video of that shark encounter yesterday. I'll look and if I find it I'll post it here later.