** In Shell mode, the command shell-copy-environment-variable lets you copy the value of a specified environment variable from the subshell into Emacs.