From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3193 invoked from network); 2 May 2003 16:08:19 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 2 May 2003 16:08:19 -0000 Received: (qmail 4097 invoked by alias); 2 May 2003 16:08:07 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 6065 Received: (qmail 4089 invoked from network); 2 May 2003 16:08:07 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 2 May 2003 16:08:07 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [216.182.10.250] by sunsite.dk (MessageWall 1.0.8) with SMTP; 2 May 2003 16:8:7 -0000 Received: from localhost (localhost [127.0.0.1]) (uid 0) by asfast.net with local; Fri, 02 May 2003 12:08:05 -0400 To: zsh-users@sunsite.dk Subject: Re: Word splitting in parameter expansion References: <10178.1051890992@csr.com> From: Lloyd Zusman >Return-Path: ljz@asfast.com Reply-To: ljz@asfast.com Date: Fri, 02 May 2003 12:08:05 -0400 In-Reply-To: <10178.1051890992@csr.com> (Peter Stephenson's message of "Fri, 02 May 2003 16:56:32 +0100") Message-ID: User-Agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (berkeley-unix) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: Lloyd Zusman Peter Stephenson writes: > =?iso-8859-1?Q?Bj=F6rn_Lindstr=F6m?= wrote: >> I've got this in my .zshrc: >> >> man() { >> screen -h 0 -t "man $@" man $@ >> } >> >> This works fine as long as I only supply the function with one argument, >> such as "man access", but when I do "man 5 access", it interprets >> "5 access" as one argument (even though that is not what I meant ;-). > > I don't think it's doing quite what you say (although you don't see what > options you have set), but I agree it won't do what you expect... > > If the arguments are `5' and `access' I would expect the words to be > divided as: > > screen > -h > 0 > -t > man 5 > access > man > 5 > access A small correction: I believe the args would actually be divided thusly: screen -h 0 -t man 5 access man 5 access In the "man $@" portion above, the "$@" should be replaced with "5 access". > (which is certainly what I get with my option settings). The problem is > that the argument to -t is being divided into two parts. To prevent that > you need: > > man() { > screen -h 0 -t "man $*" man $@ > } > > Actually, that last argument could be $* as well; if you want to > maintain zero-length arguments it needs to be "$@". > > -- > Peter Stephenson Software Engineer > CSR Ltd., Science Park, Milton Road, > Cambridge, CB4 0WH, UK Tel: +44 (0)1223 692070 > > > ********************************************************************** > The information transmitted is intended only for the person or > entity to which it is addressed and may contain confidential > and/or privileged material. > Any review, retransmission, dissemination or other use of, or > taking of any action in reliance upon, this information by > persons or entities other than the intended recipient is > prohibited. > If you received this in error, please contact the sender and > delete the material from any computer. > ********************************************************************** -- Lloyd Zusman ljz@asfast.com