From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23269 invoked from network); 18 May 2005 09:49:40 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 18 May 2005 09:49:40 -0000 Received: (qmail 98467 invoked from network); 18 May 2005 09:49:34 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 18 May 2005 09:49:34 -0000 Received: (qmail 24755 invoked by alias); 18 May 2005 09:49:23 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 8862 Received: (qmail 24735 invoked from network); 18 May 2005 09:49:22 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 18 May 2005 09:49:22 -0000 Received: (qmail 97191 invoked from network); 18 May 2005 09:49:22 -0000 Received: from mailhost1.csr.com (HELO MAILSWEEPER01.csr.com) (81.105.217.43) by a.mx.sunsite.dk with SMTP; 18 May 2005 09:49:11 -0000 Received: from exchange03.csr.com (unverified [10.100.137.60]) by MAILSWEEPER01.csr.com (Content Technologies SMTPRS 4.3.12) with ESMTP id for ; Wed, 18 May 2005 10:47:23 +0100 Received: from csr.com ([10.102.144.127]) by exchange03.csr.com with Microsoft SMTPSVC(5.0.2195.6713); Wed, 18 May 2005 10:50:34 +0100 To: zsh-users@sunsite.dk Subject: Re: variable assignment in a script using globsubst In-Reply-To: Message from Vincent Stemen of "Tue, 17 May 2005 23:43:55 CDT." <20050518044354.GA96824@quark.hightek.org> References: <20050518044354.GA96824@quark.hightek.org> Date: Wed, 18 May 2005 10:49:10 +0100 Message-ID: <17522.1116409750@csr.com> From: Peter Stephenson X-OriginalArrivalTime: 18 May 2005 09:50:34.0940 (UTC) FILETIME=[0998FFC0:01C55B8F] X-Spam-Checker-Version: SpamAssassin 3.0.2 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, score=-2.6 required=6.0 tests=AWL,BAYES_00 autolearn=ham version=3.0.2 X-Spam-Hits: -2.6 Vincent Stemen wrote: > Any idea why this works from the command line, > > $ setopt globsubst > $ files=/bin/c*; echo $files > /bin/cat /bin/chflags /bin/chio /bin/chmod /bin/cp /bin/csh > > but in a script, it does not? > > The script works if I set globassign in the script, but it assigns it > as an array rather than a string. However, the manual says, this > about globassign. > "This option is provided for backwards compatibility only" > > Am I overlooking some other option that could be affecting it? No, it must simply be that you have globassign set interactively, e.g. in .zshrc or /etc/zshrc. It always assigns an array; you'll find in the interactive case $files[1] is /bin/cat. It's "for backwards compatibility only" exactly because of this confusion: the syntax says "scalar", but the glob says "array". files=(/bin/c*) is the right way to do this. -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070 ********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. **********************************************************************