Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATH_DIRS
- X-seq: zsh-users 22813
- From: Ray Andrews <rayandrews@xxxxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>, Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: PATH_DIRS
- Date: Thu, 10 Aug 2017 22:07:27 -0700
- In-reply-to: <CAH+w=7Yd0O2_KqXe84X95-zgLFZOoCzLPKMWUrkT6hGh4jf8Ww@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: <ff4bbb1d-10a9-d95f-a721-4afca5fdf95d@eastlink.ca> <CAH+w=7Yd0O2_KqXe84X95-zgLFZOoCzLPKMWUrkT6hGh4jf8Ww@mail.gmail.com>
On 10/08/17 03:19 PM, Bart Schaefer wrote:
PATH_DIRS is a setopt, it *uses* $PATH. It's not a parameter
providing alternate directories.
I would have been up the garden path there, cuz I:
$ PATH_DIR=/aWorking/Zsh/System
$ echo $PATH_DIR
/aWorking/Zsh/System
... which seemed to do just as I thought I was expecting, however now I
see that since that directory is on my PATH anyway, it worked but only
(it seems) by virtue of it working all the time anyway and I just
didn't realize that, and I was making an unrelated and useless variable
:( Now I see that I completely missed the real use of that setopt.
Thanks, God only knows how many knots I'd have tied myself into there.
Anyway, it already does search like that. You just have to chmod +x
the script files (and add a #! line if they aren't zsh scripts).
However, scripts are run even if chmod -x, tho whence will only find
them if '+x'. Am I somehow missing the boat there?
What it WON'T do is source scripts it finds that way into the current
shell. It'll always fork a subshell for them. Too many opportunities
for mayhem if the user hasn't explicitly asked (via the "." command)
to have his current shell altered (potentially) by the script.
Yeah, I don't begrudge the dot, good to know what one is doing. Still, I
find myself wanting whence to find anything that is executable on the
PATH. If I can:
/aWorking/Zsh/System $ ls -l somescript
-rw-r--r-- 1 root root 24 Aug 10 21:55 somescript <<< not marked
executable.
/aWorking/Zsh/System $ cat somescript
echo this is somescript
/aMisc $ . somescript
this is somescript
... so it will be run if it's a script on my PATH, even if not '+x' then
it seems intuitive that whence would also be able to find it.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author