How does the shell environment load when logging in graphically?

view story

http://askubuntu.com – I've found that when logging in graphically the shell loading process works differently than logging in through the console. Environment variables such as $BASH_VERSION and $ZSH_VERSION are not set when logging in graphically, and a script specifically written for bash and zsh that I tried to use while logging in causes the login process to restart and returns me to the login prompt (which stops me from logging in while this script is in place), when logging in through the console the same setup works fine though. Here's the case where I am experiencing the issue. Is the shell loading process (HowTos)