If a grizzly bear attacks you, it is essential to maintain your composure and not make any precipitous movements and avoid making direct eye contact with the bear; it is a sign of aggression. Instead, show the bear you are submissive by backing away slowly and speaking to it in a calm, monotone voice, which helps the bear to feel less threatened.
However, if the bear continues to come toward you, then use bear spray, which is a canister of pepper spray. It is designed to repel and frighten the bear. The bear spray is a last resort and guns are not recommended because most national parks ban the use of firearms.