The fact is, if Rick did know that Shane was gonna come back, then it strains credibility that he'd suddenly forget ...
Has anyone on the show turned that quickly
in front of Rick? IIRC, everyone that he's seen turn did so in a matter of hours (or even days), not minutes.
Unless the CDC guy specifically told Rick "everyone who dies comes back and sometimes in seconds", Rick could easily assume he had at least a few more minutes to finish off Shane.
Furthermore, sometimes people don't react to things immediately, especially in a stressful situation.