With your plan, you might get in a shot but then they are going to bowl you over and repeatedly stab you.
So you need to shoot them before they rush or pass the rush and then shoot them.
Well, gun v. knife, I’ll just let fly with up to 17 rounds fast in their direction, aimed if possible. Springfield XD 9, recently lost in a tragic canoeing accident.
I’m primarily talking about a knife fight. Probably knife (me) v. unarmed doofus. My goal would be to put the hurt on them so bad before they got to my center of mass that when they actually arrive at my center of mass, they’re probably well on the way to dead. That may be unrealistic. But fencing is the only skill I have in the vicinity of a knife fight.
So, as another poster noted, turn the knife horizontally, and stab severally. That’ll have to do, unless someone has a quick primer on knife fighting with which I can improve.