Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Sub-folders in $PATH?
- X-seq: zsh-users 21730
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: Johan DS <victor3xray@xxxxxxxxx>
- Subject: Re: Sub-folders in $PATH?
- Date: Tue, 05 Jul 2016 04:57:53 +0000
- Cc: TJ Luoma <luomat@xxxxxxxxx>, Zsh-Users List <zsh-users@xxxxxxx>
- In-reply-to: <CAEyXbzcge3DWff-uFy4+ZL3Nbbbqs+FyYcBOMVkBLugv7--jzg__46346.1699583151$1467502045$gmane$org@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CADjGqHtZ61wcSaL_SEKT7Kw=6DpByp9=mdz1eZbYyvgA8QCAZQ@mail.gmail.com> <CAEyXbzcge3DWff-uFy4+ZL3Nbbbqs+FyYcBOMVkBLugv7--jzg__46346.1699583151$1467502045$gmane$org@mail.gmail.com>
Johan DS wrote on Sun, Jul 03, 2016 at 01:26:06 +0200:
> On Sun, Jul 3, 2016 at 12:15 AM, TJ Luoma <luomat@xxxxxxxxx> wrote:
>
> > Is there an option to have subfolders in a $PATH folder searched as well?
Consider: setopt PATH_DIRS
> > For example, if I wanted to put some folders in /usr/local/bin/scripts/
> > without explicitly adding /usr/local/bin/scripts/ to $PATH
> > (assuming /usr/local/bin/ was already in there).
> >
> > TJ
>
> Hi
> I have this in my .zshenv
>
> export
> PATH=$PATH:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:
> [[ -d ~/bin ]] && export PATH=${PATH}:$(find ~/bin -type d | tr '\n' ':' |
> sed 's/:$//') #include all ~/bin/subdirs
Another way of doing the same thing:
path+=(
/usr/local/bin /usr/bin /bin /usr/local/sbin /usr/sbin /sbin
~/bin/**/*(/N)
)
(unlike Roman's solution this uses ** to be equivalent to the find(1))
Messages sorted by:
Reverse Date,
Date,
Thread,
Author