Similar commands can be used to parse the rest of the output (e.g. by replacing \$VIM: with system vimrc file:).

Actual value of $VIM

However, the real location might have been changed from this default. To get the actual location, one can echo the value of the environment variable itself and grab the output. Vim’s Ex mode is useful for this:

VIMENV=$(vim -E +'!echo $VIM' +qall < /dev/null | tr -d "\n")

Note that an input redirection from /dev/null is used to prevent Vim from attempting to blank the terminal. Without the redirection, the output will contain unwanted control characters. Also, in both of the previous snippets, the output is piped through tr -d "\n" to remove the trailing newline.