From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22175 invoked by alias); 12 Jul 2010 16:07:12 -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: 15171 Received: (qmail 13762 invoked from network); 12 Jul 2010 16:07:07 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at csr.com does not designate permitted sender hosts) Date: Mon, 12 Jul 2010 17:06:48 +0100 From: Peter Stephenson To: zsh-users@zsh.org Subject: Re: zsh portable script Message-ID: <20100712170648.706cb975@csr.com> In-Reply-To: <1007130241570.5546@smasher> References: <1007130241570.5546@smasher> Organization: Cambridge Silicon Radio X-Mailer: Claws Mail 3.7.6 (GTK+ 2.18.9; i686-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 12 Jul 2010 16:06:48.0917 (UTC) FILETIME=[3BC04850:01CB21DC] X-Scanned-By: MailControl A_09_40_00 (www.mailcontrol.com) on 10.68.0.134 On Tue, 13 Jul 2010 02:46:22 +1200 (NZST) Atom Smasher wrote: > on freebsd, zsh installs as /usr/local/bin/zsh. on linux (and most > other systems?) it installs as /usr/bin/zsh. > > what's the best way to make zsh script portable between linux and > freebsd? > > i could start the script with: > #!/usr/bin/env zsh > > or i could specify that the script be executed as: > zsh script > > is there a better way? Looking at the responses, on which I can't improve, one might speculate it was time for someone to implement path searching down in the #! handler for relative paths. #!zsh print "Found zsh in $0". I don't think it has any misfeatures that the env method doesn't have, and it improves on it in important ways. This doesn't really touch zsh except that we could do it in our own #! handler (see zexecve() in Src/exec.c). (Follow-ups should probably go to zsh-workers). -- Peter Stephenson Software Engineer Tel: +44 (0)1223 692070 Cambridge Silicon Radio Limited Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom