+2  A: 

Shell scripts can't modify their enviroment.

http://tldp.org/LDP/abs/html/gotchas.html

A script may not export variables back to its parent process, the shell, or to the environment. Just as we learned in biology, a child process can inherit from a parent, but not vice versa

$ cat > eg.sh 
export FOO="bar";
^D
$ bash eg.sh 
$ echo $FOO; 

$

also, the problem is greater, as you have multiple calls of bash

bash 1 -> hg -> bash 2 ( shell script ) 
             -> bash 3 ( env call )

it would be like thinking I could set a variable in one php script and then magically get it with another simply by running one after the other.

Kent Fredric
seems strange that he says the script works when run by itself
Corporal Touchy
i am fairly certain that the shell script, which is huge and incredibly complicated starts a new shell process, so that might be where i am getting confused, it doesn't actually set them in the parent process, just the one it creates, that then gets terminated
Mjr578
A: 

okay, so calling 'export VARIABLE' in a shell script makes that available to the current running shell process though, correct?

Mjr578
See my expanded answer. the problem is the shell the export is running in is terminating briefly after you do the export.
Kent Fredric
thank you for the help
Mjr578