Michael,
I've been using something like the following, though I'm sure it could be
written more concisely:
if status --is-login
# We are the login shell
# Inteligently update $PATH
# Add some stuff to the path
set -l path_list /usr/local/bin /usr/local/sbin /usr/local/share/python
/usr/local/share/python3 /usr/local/bin/include /usr/local/bin/lib
/usr/local/share/npm/bin
# For each item in PATH, if it isn't in path_list and it is a valid directory
then add it to path_list
for item in $PATH
if not contains $item $path_list
if test -d $item
set path_list $path_list $item
end
end
end
# For each item in path_list, if it is a valid directory then add it to temp
for item in $path_list
if test -d $item
set temp $temp $item
end
end
# Set path to temp
set -x PATH $temp
end
On Aug 18, 2013, at 6:01 AM, Michael Stillwell <[email protected]> wrote:
> Thanks. This mostly works, but yes, if you something starts up a
> sub-shell, the path gets listed twice. I can't think of any realistic
> situation where this would actually be a problem, but it is a bit
> annoying!
>
>
>
>
> Michael
>
> On Sun, Aug 18, 2013 at 1:11 AM, Nathan DeGruchy <[email protected]> wrote:
>> In my ~/.config/fish/config.fish:
>>
>> set PATH $PATH /path/to/directory
>>
>> I don't know about sub-shells, but this works for me on mutliple platforms
>> (OS
>> X and Linux)
>>
>> On Sunday, August 18, 2013 12:25:12 AM Michael Stillwell wrote:
>>> What's the recommended way to add a directory to $PATH? It seems like
>>> a simple task, but I'm having trouble preventing the directory from
>>> being added multiple times every time I spawn a subshell, and making
>>> the new path available to child processes...
>>>
>>> I'd also like the same code to work on OS X and Linux. fish is my
>>> login shell on both.
>>>
>>>
>>>
>>>
>>> Michael
>>>
>>> ----------------------------------------------------------------------------
>>> -- Get 100% visibility into Java/.NET code with AppDynamics Lite!
>>> It's a free troubleshooting tool designed for production.
>>> Get down to code-level detail for bottlenecks, with <2% overhead.
>>> Download for free and get started troubleshooting in minutes.
>>> http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
>>> _______________________________________________
>>> Fish-users mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/fish-users
>> --
>> Nathan DeGruchy
>> degruchy.org
>> ------------------------------------------------------------------------------
>> Get 100% visibility into Java/.NET code with AppDynamics Lite!
>> It's a free troubleshooting tool designed for production.
>> Get down to code-level detail for bottlenecks, with <2% overhead.
>> Download for free and get started troubleshooting in minutes.
>> http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
>> _______________________________________________
>> Fish-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/fish-users
>>
>
> ------------------------------------------------------------------------------
> Get 100% visibility into Java/.NET code with AppDynamics Lite!
> It's a free troubleshooting tool designed for production.
> Get down to code-level detail for bottlenecks, with <2% overhead.
> Download for free and get started troubleshooting in minutes.
> http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
> _______________________________________________
> Fish-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/fish-users
------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
Fish-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fish-users