From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16654 invoked by alias); 6 Jan 2017 16:06:00 -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: 22334 Received: (qmail 17738 invoked from network); 6 Jan 2017 16:06:00 -0000 X-Qmail-Scanner-Diagnostics: from mout.gmx.net 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(212.227.15.15):SA:0(-1.9/5.0):. Processed in 0.81828 secs); 06 Jan 2017 16:06:00 -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=FREEMAIL_FROM, RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: llua@gmx.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at gmx.com designates 212.227.15.15 as permitted sender) Subject: Re: NOMATCH errors To: zsh-users@zsh.org References: <1483673721.1546772.838942313.0683A864@webmail.messagingengine.com> From: Eric Cook Message-ID: <04e61d8e-5d7b-20f2-f22f-3029e1a5e8fb@gmx.com> Date: Fri, 6 Jan 2017 11:05:47 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: <1483673721.1546772.838942313.0683A864@webmail.messagingengine.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:Uz6iir4/qVwIHjPePiz8DDzke+PFp+F3UtrMRmtChL/iVjn3P8F zKiqmcIWUQVGTYtuQLlr21xBqbJMdoiTQnWa02u5Dpji+tj++J62Cvq1oJzu44wC5STXJE3 uO7xtGX1KAFVrJKXc9QNqU88PusHE+A+DiyvgKQ8qlGoIRNTCBSVKNvkuYdVxHj/xTefjvV Ue00v7HXrYtz05J+LBp/g== X-UI-Out-Filterresults: notjunk:1;V01:K0:AhF9m7xgr3Y=:o0ODsU1ybG5n2ZWhEdk9MZ WJIpxQ04Tpn8MY2MgMsLOPbJFLkQVUai8bd3pG5bENsHdCwHqoU6OMiaVwYTO9E/CKeAh06+b R7ueoX3/cQSfEOhycSRP8qWi8/KwlYCypHAYKbgveS8GKfD7pQQ3nzryDy9J1iFn5+YxQk1+9 wtW1fXUcehG/CT0bi47AigOUvN6JwS10uP8/kt6Ojo/Ry+TDll7VoZcIle4oFYYLvluh5Hfll tFLyn1Y9FFu5iYURKN2xCVILw5nC+4p8UX0WlI9mA/Fx19w0SMZmVSb61WaQYJ4FhptX+99U+ EYtNJn887sAfHhvB0OsOuEvAUQXUDT8G9PWBEXiGI78xPqNJV/hKS8VE1r+V7YHlHom1OM3DM P1f7WqsV/pHffZpB02j/Dvu54S9xyJmMDyIstKNoLn7uSHwz1jhWMpAPGx21tdwEOqvegDOEw THk8RHoRqGBdPDhCBqE2awToCms7cflpMkQ1qHmvrEJ6N3dXI0RLpxrBgB9czUOBbD7nViyub cFkFxQowUeYCwkIIsefWCr9LfOcec2ZAwEzAW/p0XmSH809Tdj/l4OkpVshCByKnQ2uRoJUxE lcFevR9e1LEhiXRNBnBLVjic3aV703tAI0P0MVxPMy1hsskfr7AS0sdxsY1V7iaX6FvYBXUa2 Vx1+gzMdwLMxNzrElQBHEXjbSIV964c028IZuvg9EdoBvdgpse3nxZtc/iBXw2R4I3fVI64v3 Dq+LrSlZrGdzJua7oTs7b13alGgqm5W+V3cYNV8AaERYTsW05IXxF8saAssZk1dJ6HA2OkBUY 785l9IA On 01/05/2017 10:35 PM, Anthony Heading wrote: > Hi, > > I was dusting off an old script which, admittedly inelegantly, did > PYTHON==python 2>/dev/null > with NOMATCH set, which in the zsh 5 era seems to be a fatal error, i.e. > a script > > So I was wondering the cleanest way to do this. `which python` is the > old-school > way, I guess, but the documentation isn't very reassuring about output > format > Any thoughts appreciated, especially if I'm missing a neat way to do > this. > > Thanks > > Anthony zsh already hashes commands at startup, you can access that entry with $commands[python]. Since what =python would resolve to already hashed, just calling python is fine. Unless the script installs python or an additional `python', in the former case zsh will notice python isn't in the command hash table, add it and run the command, all during the first time the script calls python. In the latter case, if the additional `python' binary is early in PATH and you want to use it, running ''rehash python'' would hash it. If the point of PYTHON==python was just to use $PYTHON in place of just python under the guise of "always use the absolute paths to commands to prevent future PATH lookups" advise some people spout, it's pretty superfluous since zsh already hashed the command and won't do another PATH lookup unless you use rehash (hash -r) or =python.