Results 1 to 5 of 5

Thread: Deleting rebellious environment variable

  1. #1
    Join Date
    Apr 2009
    Beans
    82

    Question Deleting rebellious environment variable

    Hello all, I'm having a bit of a problem with a pesky old environment variable that I created maybe a year ago or so, now I would like to change it and for the life of me, this thing is like a zombie! It just won't die! huh? Ok, so, I did my due diligent research, I checked all these common files where environment variables are strewn around, to see if I did indeed set it in there and forgot about it: /etc/bash.bashrc, /etc/environment, ~/.profile, ~/.bashrc . Nothing. So just to be clear, I got this environment variable that I set a long time ago, now when I open a terminal and type "zombie_variable=newstuff; export zombie_variable", it sets it only for that session of terminal. If I start another terminal and do "env" the oldstuff comes up. I just can't seem to be able to either kill the variable or change its content permanently... where should I look?

  2. #2
    Join Date
    May 2006
    Location
    Amsterdam
    Beans
    1,731
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: Deleting rebellious environment variable

    what is the name of the zombie variable?

    You can also use the unset command.

    unset ZOMBIE and it should be gone.. and/or use export ZOMBIE="" but, I guess finding where it is would be more usefull
    Upgrade Ubuntu | Upgrade unsupported Ubuntu versions | Always backup | Howto upgrade flash
    Minimal CD install | Remove old kernels | My blog | Linux user #462801 | Conscience doth make cowards of us all. -- Shakespeare

  3. #3
    Join Date
    Apr 2009
    Location
    Midwest, U.S.A.
    Beans
    1,209
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Deleting rebellious environment variable

    This should do the trick, just change maxdepth to your liking.
    Code:
    find . -maxdepth 1 -type f | xargs grep "ZOMBIE_VAR="
    You may want to check in your $HOME directory and /etc/.
    Laptop: Dell Inspiron 8200 - Fedora 13 - Goddard
    Desktop: Self-Built - [Ku, Lu, Xu, U]buntu - Lucid 10.04.3 (LTS)
    Linux User: 498249 / Ubuntu User: 29241

  4. #4
    Join Date
    May 2006
    Location
    Amsterdam
    Beans
    1,731
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: Deleting rebellious environment variable

    Quote Originally Posted by AlphaLexman View Post
    This should do the trick, just change maxdepth to your liking.
    Code:
    find . -maxdepth 1 -type f | xargs grep "ZOMBIE_VAR="
    You may want to check in your $HOME directory and /etc/.
    grep -r ZOMBIE $HOME /etc will do the trick as well. maxdepth 1 is the same as grep ZOMBIE $HOME/* /etc/*

    And there is no need for xargs:

    Code:
    find /etc $HOME -type f -exec grep ZOMBIE {} + 
    # or this one (is a bit slower)
    find /etc $HOME -type f -exec grep ZOMBIE {} \;
    Upgrade Ubuntu | Upgrade unsupported Ubuntu versions | Always backup | Howto upgrade flash
    Minimal CD install | Remove old kernels | My blog | Linux user #462801 | Conscience doth make cowards of us all. -- Shakespeare

  5. #5
    Join Date
    Apr 2009
    Beans
    82

    Re: Deleting rebellious environment variable

    Slakkie: thanks, that first line of code did it. It turns out that the environment variable was buried deep in a shell script located in /etc/profile.d that was created automatically when I installed the program and configured it.

    So, moral of the story is: environment variables could be located in ANY bash (or other shell) script file, created by a user or process.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •