I'm trying to make a utility which will help with managing your environment variables.
One thing I'd like it to tell you is what all your environment variables are, and which line in which file set them to what they are.
Right now, it checks the following files to determine this:
/etc/profile
/etc/paths
/etc/paths.d/*
~/.bash_profile
~/.bash_login
~/.profile
~/.bashrc
/etc/bashrc
By parsing out those files, it's able to tell you where each of these variables came from:
LSCOLORS (line 6 of ~/.bash_profile, for me... I added it myself so it's not default)
PATH (mix of ~/.bash_profile, /etc/paths, and /etc/paths.d/40-XQuartz)
PS1 (line 4 of ~/.bash_profile)
PS2 (line 5 of ~/.bash_profile)
PYTHONSTARTUP (line 20 of ~/.bash_profile)
So that's neat so far - especially the break down of PATH. But there's a lot of variables that my utility can't find the origin of yet. Does anyone happen to know where the following come from? I'd like to be able to present users with the line number and file where they can go to change the variable, even if that's a bad idea.
I know some might actually be special variables not actually read from any file (IE, PWD and OLDPWD, perhaps) but surely some of these are variables that get read in from files that I just don't know about yet.
Apple_PubSub_Socket_Render
DISPLAY
HOME
LANG
LOGNAME
OLDPWD
PWD
SHELL
SHLVL
SSH_AUTH_SOCK
TERM
TERM_PROGRAM
TERM_PROGRAM_VERSION
TERM_SESSION_ID
TMPDIR
USER
XPC_FLAGS
XPC_SERVICE_NAME
_ (What is this one even? It's pointing at /Library/Frameworks/Python.framework/Versions/2.7/bin/python)
__CF_USER_TEXT_ENCODING
Edit: Was hoping /etc/passwd would be useful and be where things like HOME, SHELL, and USER are set. It is not. It mentions something called opendirectoryd. I checked the man page for that, and it mentions a lot of files, but none of them seem to hold anything pertaining to the HOME, SHELL, or USER variables, either.
One thing I'd like it to tell you is what all your environment variables are, and which line in which file set them to what they are.
Right now, it checks the following files to determine this:
/etc/profile
/etc/paths
/etc/paths.d/*
~/.bash_profile
~/.bash_login
~/.profile
~/.bashrc
/etc/bashrc
By parsing out those files, it's able to tell you where each of these variables came from:
LSCOLORS (line 6 of ~/.bash_profile, for me... I added it myself so it's not default)
PATH (mix of ~/.bash_profile, /etc/paths, and /etc/paths.d/40-XQuartz)
PS1 (line 4 of ~/.bash_profile)
PS2 (line 5 of ~/.bash_profile)
PYTHONSTARTUP (line 20 of ~/.bash_profile)
So that's neat so far - especially the break down of PATH. But there's a lot of variables that my utility can't find the origin of yet. Does anyone happen to know where the following come from? I'd like to be able to present users with the line number and file where they can go to change the variable, even if that's a bad idea.
I know some might actually be special variables not actually read from any file (IE, PWD and OLDPWD, perhaps) but surely some of these are variables that get read in from files that I just don't know about yet.
Apple_PubSub_Socket_Render
DISPLAY
HOME
LANG
LOGNAME
OLDPWD
PWD
SHELL
SHLVL
SSH_AUTH_SOCK
TERM
TERM_PROGRAM
TERM_PROGRAM_VERSION
TERM_SESSION_ID
TMPDIR
USER
XPC_FLAGS
XPC_SERVICE_NAME
_ (What is this one even? It's pointing at /Library/Frameworks/Python.framework/Versions/2.7/bin/python)
__CF_USER_TEXT_ENCODING
Edit: Was hoping /etc/passwd would be useful and be where things like HOME, SHELL, and USER are set. It is not. It mentions something called opendirectoryd. I checked the man page for that, and it mentions a lot of files, but none of them seem to hold anything pertaining to the HOME, SHELL, or USER variables, either.
Last edited: