Accomplishes environment rewrite with a single curl by using a temporary...

... file

Uses a temporary file called TFILE based on the PID of the bash script which is stored in $$.

Removes the temporary file after it is done.