From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26079 invoked by alias); 11 Aug 2017 05:07:34 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 22813 Received: (qmail 25064 invoked by uid 1010); 11 Aug 2017 05:07:34 -0000 X-Qmail-Scanner-Diagnostics: from mta02.eastlink.ca by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(24.224.136.13):SA:0(-0.7/5.0):. Processed in 2.767162 secs); 11 Aug 2017 05:07:34 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD,SPF_PASS autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: rayandrews@eastlink.ca X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | X-Authority-Analysis: v=2.2 cv=V8gN6avi c=1 sm=1 tr=0 a=8gj3v1wGPP1N//wMR4mB5g==:117 a=8gj3v1wGPP1N//wMR4mB5g==:17 a=IkcTkHD0fZMA:10 a=TDsrzSstKpnutNK0fzoA:9 a=QEXdDO2ut3YA:10 X-EL-IP-NOAUTH: 24.207.98.138 Subject: Re: PATH_DIRS To: Bart Schaefer , Zsh Users References: From: Ray Andrews Message-id: <1852003c-c07c-dc61-b863-007f0cef9111@eastlink.ca> Date: Thu, 10 Aug 2017 22:07:27 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-version: 1.0 In-reply-to: Content-type: text/plain; charset=utf-8; format=flowed Content-transfer-encoding: 7bit Content-language: en-CA 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.