From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18384 invoked by alias); 31 Mar 2018 17:21:18 -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: List-Unsubscribe: X-Seq: 23296 Received: (qmail 26977 invoked by uid 1010); 31 Mar 2018 17:21:18 -0000 X-Qmail-Scanner-Diagnostics: from mta01.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.30):SA:0(-1.9/5.0):. Processed in 10.896055 secs); 31 Mar 2018 17:21:18 -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=-1.9 required=5.0 tests=BAYES_00,SPF_PASS, T_RP_MATCHES_RCVD 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: | MIME-version: 1.0 Content-transfer-encoding: 8BIT Content-type: text/plain; charset=utf-8; format=flowed X-Authority-Analysis: v=2.3 cv=dfKuI0fe c=1 sm=1 tr=0 a=RnRVsdTsRxS/hkU0yKjOWA==:117 a=RnRVsdTsRxS/hkU0yKjOWA==:17 a=IkcTkHD0fZMA:10 a=N3PiWSB7C6myVlAgGJsA:9 a=QEXdDO2ut3YA:10 X-EL-IP-NOAUTH: 24.207.101.9 Subject: Re: whence (was Re: local unfunction) To: zsh-users@zsh.org References: From: Ray Andrews Message-id: <6935145d-785f-f2dd-d4f2-e7ea627e2bc3@eastlink.ca> Date: Sat, 31 Mar 2018 10:21:01 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 In-reply-to: Content-language: en-CA On 31/03/18 08:25 AM, Bart Schaefer wrote: > % whence -wm "zsh*" $ whence -wm "zsh*" zsh: command zsh5.3: command        # binary zsh5.3:: command        # text file ... I've yet to understand what the point of the '-w' switch is. I dunno Bart, it seems I'm the only guy who has issues with whence so perhaps I shouldn't belabour all this but it seems riddled with bugs to me. '-m' and '-a' seem to fight each other and the results are inconclusive.  whence is important, one needs to know what is going to be executed when one types a command, these ifs and buts are frustrating.  My wrapper around whence is approaching 300 lines, and it's only purpose is to give one-stop shopping for what, it seems to me, whence should do anyway: -a # keep looking after the first match (the one to be executed) is found -m # find all matches of a pattern, subsumes '-a'  (executable ONLY unless ... ) -t # Show non executable (text?) files as well, obviates -a, subsumes 'm'. -s, -S  # Expand links, even if found on 'dot' on the path. So: 'whence -mts "zsh*" ' ... would give me one stop shopping for anything that is either directly executable or sourcable via path search (which zsh does anyway).  '-a' is actually redundant: $ whenz zsh # Command that will be executed. $ whenz -m zsh # Keep searching. (no pattern but so what, keep searching anyway.) $ whenz -m "zsh*" # Keep searching and match the pattern too (because one is given). $ whenz -mt "zsh*" # As above, but match non executables on the path as well. $ whenz -mtS "zsh*" As above but show link chains, even on the 'dot', even on Tuesdays. Logical?