1

There is a global environment variable that was declared somewhere in my OS. Let's say is called FOOBAR

When I echo it, I receive a proper output:

$ echo $FOOBAR
localhost%6200

I want to know where is defined because I need to update its value for certain process. Currently, I am declaring this value manually in a script before executing my processes, just to override it:

#!/bin/sh
# other comands...
export FOOBAR=localhost%16200
# rest of script

Still, I'm curious about why I cannot find the definition of this variable.

I have gone through several posts like these:

I've looked into ~/.bashrc, /etc/profile, scripts in /etc/profile.d/, I've executed several commands and tried different variations, like searching in all /etc and /home/MyUser and still no luck.

The only hint I got is this output from searching through /home/MyUser:

$ find /home/MyUser -type f -exec grep -F FOOBAR {} +
... lines ...
/home/MyUser/.xsession-errors:dbus-update-activation-environment: setting FOOBAR=localhost%6200

Then I tried looking at the variables defined for dbus by using this command

$ systemctl --user show-environment
... among other variables ...
FOOBAR=localhost%6200

There I see it!

How can I track this environment variable definition?

  • Why are you hiding the name of the variable? The name may not be important to you, but someone gave it a name for a reason, use it. Is it an X variable? if so why are you wanting to change it? – j-money Feb 13 at 8:24
  • @j-money is a variable from a closed source program we should use in the company for one of our clients. – Luiggi Mendoza Feb 13 at 15:19
  • Ask the creators of the program then, – j-money Feb 13 at 15:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.