From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1518 invoked from network); 1 Nov 2005 18:23:45 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 1 Nov 2005 18:23:45 -0000 Received: (qmail 30845 invoked from network); 1 Nov 2005 18:23:37 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 1 Nov 2005 18:23:37 -0000 Received: (qmail 22837 invoked by alias); 1 Nov 2005 18:23:31 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9604 Received: (qmail 22828 invoked from network); 1 Nov 2005 18:23:30 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 1 Nov 2005 18:23:30 -0000 Received: (qmail 29802 invoked from network); 1 Nov 2005 18:23:30 -0000 Received: from cluster-d.mailcontrol.com (HELO rly26d.srv.mailcontrol.com) (217.69.20.190) by a.mx.sunsite.dk with SMTP; 1 Nov 2005 18:23:26 -0000 Received: from exchange03.csr.com (mailhost1.csr.com [81.105.217.43]) by rly26d.srv.mailcontrol.com (MailControl) with ESMTP id jA1INObh032711 for ; Tue, 1 Nov 2005 18:23:25 GMT Received: from news01 ([10.103.143.38]) by exchange03.csr.com with Microsoft SMTPSVC(5.0.2195.6713); Tue, 1 Nov 2005 18:25:48 +0000 Date: Tue, 1 Nov 2005 18:23:22 +0000 From: Peter Stephenson To: zsh-users@sunsite.dk Subject: Re: run-help and \cmd (was: Simple Tip of the Day) Message-Id: <20051101182322.2c31770f.pws@csr.com> In-Reply-To: References: <87ek65zwuw.fsf@trews52.bothi.fi> <200510291637.58926.kos@supportwizard.com> <200510291652.30264.cht@chello.at> <20051101165501.GK27583@ay.vinc17.org> Organization: Cambridge Silicon Radio X-Mailer: Sylpheed version 0.9.12 (GTK+ 1.2.10; i386-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 01 Nov 2005 18:25:48.0500 (UTC) FILETIME=[AE802940:01C5DF11] X-Scanned-By: MailControl A-05-40-01 (www.mailcontrol.com) on 10.68.0.136 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.0.4 Peter Stephenson wrote: > You mean run-help on \ls doesn't work? The shell doesn't know what the > run-help alias/function is going to do with the information so provides > exactly what it got. Using a more sophisticated version of run-help would > do the trick; even turning "man $1" into "eval man $1" would work. > However, that's a little dangerous to have as the default. Slightly more helpfully, here is the run-help function supplied with the shell enhanced to strip quotes (and suppress alias lookup for the stripped word) when that makes a difference. Index: Functions/Misc/run-help =================================================================== RCS file: /cvsroot/zsh/zsh/Functions/Misc/run-help,v retrieving revision 1.4 diff -u -r1.4 run-help --- Functions/Misc/run-help 2 Apr 2001 13:04:05 -0000 1.4 +++ Functions/Misc/run-help 1 Nov 2005 18:20:50 -0000 @@ -33,15 +33,22 @@ fi # No zsh help; use "whence" to figure out where else we might look -local what places newline=' +local what places noalias newline=' ' integer i=0 didman=0 places=( "${(@f)$(builtin whence -va $1)}" ) +if [[ $places = *"not found"* && $1 != ${(Q)1} ]]; then + # Different when unquoted, so try stripping quotes. + places=( "${(@f)$(builtin whence -va ${(Q)1})}" ) + # Quotation is significant to aliases, so suppress lookup. + noalias=1 +fi while ((i++ < $#places)) do what=$places[$i] + [[ -n $noalias && $what = *" is an alias "* ]] && continue builtin print -r $what case $what in (*( is an alias)*) -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070 This message has been scanned for viruses by BlackSpider MailControl - www.blackspider.com