Find the answer to your Linux question:
Results 1 to 4 of 4
Soooo.... New Linux Newbie joining this place... I've been brushing up from my old DOS days at the command line using this set of tutorials (as well as using them ...
  1. #1
    Just Joined!
    Join Date
    Jul 2007
    Posts
    3

    Reversing exports?

    Soooo.... New Linux Newbie joining this place... I've been brushing up from my old DOS days at the command line using this set of tutorials (as well as using them to teach myself Linux).

    Writing shell scripts - Lesson 1: Writing your first script and getting it to work

    They had me create a simple hello world script (titled my_script). I did it. It wouldn't execute without an absolute or relative path. Then they told me the following:

    One of the instructions was to edit my .bash_profile or .bashrc, adding an export of ~/bin/ to my path variable. It worked as intended, and that was great. Hurray I know how to automate some environment changes!

    But uh oh. I removed the export line from both .bash_profile and .bashrc, expecting to be unable to run the script with a simple "my_script" command. I was mistaken. Echoing the $PATH variable revealed that $HOME/bin was still in my path, which I could swear was not there before... (if it were, I would not have failed prior to editing .bash_profile and .bashrc). So my question is how on earth do I get rid of it? It's nice to know how to do something, but if you can't undo it... Should you really be doing it in the first place?

    I've looked around in /etc/*.* for anywhere that is adding that to my path and I can't find it.

    Thanks in advance for your help!
    -HamsterOfDoom

  2. #2
    Super Moderator devils casper's Avatar
    Join Date
    Jun 2006
    Location
    Chandigarh, India
    Posts
    24,316
    Hi and Welcome !

    you have to regenerate PATH variable.

    either logout and login back, ( if you are using X, just close Terminal/Konsole and open it again )

    OR execute this
    Code:
    source .bashrc
    It is amazing what you can accomplish if you do not care who gets the credit.
    New Users: Read This First

  3. #3
    Just Joined!
    Join Date
    Jul 2007
    Posts
    3
    No go. executing source .bashrc leaves \home\[my-user-name]\bin in the path variable. I'm testing to see what happens when I remove /bin from my home directory (seems reasonable that it would add this outside .bash_profile and .bashrc if the directory exists). Tell ya how it turns out.

    -HamsterOfDoom

  4. #4
    Just Joined!
    Join Date
    Jul 2007
    Posts
    3

    Got it.

    Yeah - that was why it was hanging around. Some script somewhere must be detecting if $HOME/[user]/bin exists, and if it does, adding it to $PATH.

    Thanks for the reply though, it moved me in the right direction!

    -HamsterOfDoom

Posting Permissions

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