You can not edit the other user's shell startup files unless the permissions are set insecurely. Doing it without their knowledge or consent (which goes for any file in their home directory) would be considered unethical and may also be considered a breach of conduct, depending on what rules of conduct are in effect on the system.
If you have
sudo rights on the system, and consider playing this "prank", then you should not have
sudo rights on that system.
The first command would add
bash as a command at the end of
.bashrc. If this was
.bashrc in the user's home directory, and if the user was a
bash user, then this would cause an infinite recursive loop of interactive shells to be started (as soon as one such shell session was initiated), until terminated or running into resource restrictions.
The second command would cause a similar loop, but the code would only run in a single
bash process environment. This would continue until terminated, or until some environment variable (like
PATH, if the script added to it in each iteration) got too big at which point a resource limit would be reached.
On a multi-user system, both of these "pranks" may affect other users as shared resources (CPU and memory mostly) are consumed.
Editing, correcting and then saving the
.bashrc file while the above scenarios are ongoing would halt the loop, but would not release resources until the
bash process(es) of the affected user were terminated.
As a panic fix, one would be able to halt it using
pkill -U username bash as root, or with
pkill bash as the affected user. This would terminate all
bash processes of the affected user.