I want to edit $PATH directly - how?

Eric Shubert ejs at shubes.net
Fri Oct 22 07:40:10 MST 2010


That's a very good explanation, ET.

I might add that, Lee, you *never* want to reset the path to nothing. I 
expect that would break things severely, as most programs (all except 
the ones specified with an absolute path, which are few) would no longer 
be able to be found.

The best/safest way to do this is as ET explained. Fiddling with $PATH 
is something that rarely needs doing though. I'm wondering, what leads 
to be wanting to change your $PATH?

-- 
-Eric 'shubes'

On 10/22/2010 05:21 AM, kitepilot at kitepilot.com wrote:
>> Is there a way to edit $PATH ?
> I believe you are asking the wrong question, because you also state (one
> of) the right answer(s).
> You "edit $PATH" (as you say) by:
> PATH=$PATH:/something/else
> That only "edits PATH" on your current shell.
> ($PATH is just a shell variable private to a shell)
> There is is not a "global" $PATH...
> You "make the change stick", by editing .bashrc, which gets sourced
> every time you start a login shell.
> So far so good, you answered your own question, now:
>> and I'll wait till a reboot
> There are many "creative" ways to accomplish this, all of them more
> complicated than just editing your .bashrc, opening up a new login shell
> that will "see" the change (your current shell is unchanged), test the
> change, and possible reverse the changes.
> A "reboot" is totally unnecessary, once .bashrc is changed, any
> subsequent launched process will "see" the change, and conversely, those
> already running will be oblivious to it.
> You could possibly create a script in .bash_logout that detects a file,
> automagically edits .bashrc, bla, bla, bla, sounds to me like one of
> those machines like:
> http://www.urlesque.com/2010/08/19/useless-machines/
> Get the drift? :)
> ET
>
>
>
>
> leegold at speedymail.org writes:
>> Is there a way to edit $PATH ? I am using Ubuntu. I do not want anything
>> like:
>> export PATH=...additional paths..:$PATH
>> in .bashrc, that's just causing me problems.
>> I simply want to edit the path directly and I'll wait till a reboot to
>> have it stick. If there's no\ way to do this then how do I reset the
>> path to nothing and start over? The bashrc this is this additive thing
>> and just confuses me.
>> Thanks
>> ---------------------------------------------------
>> PLUG-discuss mailing list - PLUG-discuss at lists.plug.phoenix.az.us
>> To subscribe, unsubscribe, or to change your mail settings:
>> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss




More information about the PLUG-discuss mailing list