From owner-freebsd-questions@FreeBSD.ORG Tue Jun 15 17:43:15 2010 Return-Path: Delivered-To: questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BB17D1065674 for ; Tue, 15 Jun 2010 17:43:15 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mx01.qsc.de (mx01.qsc.de [213.148.129.14]) by mx1.freebsd.org (Postfix) with ESMTP id 79AD48FC1B for ; Tue, 15 Jun 2010 17:43:15 +0000 (UTC) Received: from r55.edvax.de (port-92-195-117-232.dynamic.qsc.de [92.195.117.232]) by mx01.qsc.de (Postfix) with ESMTP id A0F363D7D3; Tue, 15 Jun 2010 19:43:05 +0200 (CEST) Received: from r55.edvax.de (localhost [127.0.0.1]) by r55.edvax.de (8.14.2/8.14.2) with SMTP id o5FHh5CW001560; Tue, 15 Jun 2010 19:43:05 +0200 (CEST) (envelope-from freebsd@edvax.de) Date: Tue, 15 Jun 2010 19:43:04 +0200 From: Polytropon To: Chip Camden Message-Id: <20100615194304.89613058.freebsd@edvax.de> In-Reply-To: <20100615162505.GB31149@libertas.local.camdensoftware.com> References: <4C173909.1050101@comclark.com> <4C174283.9090903@comclark.com> <20100615162505.GB31149@libertas.local.camdensoftware.com> Organization: EDVAX X-Mailer: Sylpheed 2.4.7 (GTK+ 2.12.1; i386-portbld-freebsd7.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: "questions@freebsd.org" Subject: Re: * wildcard in.sh script X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Polytropon List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Jun 2010 17:43:15 -0000 On Tue, 15 Jun 2010 09:25:05 -0700, Chip Camden wrote: > As others have mentioned, you need to quote or escape the * in the > command line: > > admin "cell*" The problem, for explaination purposes, is that the shell you enter the command will already expand cell* to cell_A, cell_B and so on. This means that inside your script $1 will be assigned the first matching entry, $2 would be the second one, $3 a third one and so on. To avoid this, you need to directly communicate the * to your script's parameter $1, which is done by escaping or quoting it. In this case, $1 will contain a literal * inside the script. In most cases when scripting, it's useful not to assume such a complicated command line processing. You better let the shell do the expansion of *, so your script gets a lot of parameters, one for each match, and you then continue to process them. Another option is to just provide a prefix pattern to your script, and let IT then add the * to expand it internally within the script (i. e. by the shell that processes the script). So you won't have to give a * at the command line of the calling dialog shell. -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...