Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Jun 2010 21:42:06 +0800
From:      Aiza <aiza21@comclark.com>
To:        Polytropon <freebsd@edvax.de>
Cc:        "questions@freebsd.org" <questions@freebsd.org>
Subject:   Re: * wildcard in.sh script
Message-ID:  <4C18D4AE.2010606@comclark.com>
In-Reply-To: <20100615194304.89613058.freebsd@edvax.de>
References:  <4C173909.1050101@comclark.com> <4C174283.9090903@comclark.com>	<20100615162505.GB31149@libertas.local.camdensoftware.com> <20100615194304.89613058.freebsd@edvax.de>

next in thread | previous in thread | raw e-mail | index | archive | help
Polytropon wrote:
> On Tue, 15 Jun 2010 09:25:05 -0700, Chip Camden <sterling@camdensoftware.com> 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.
> 
> 
> 
> 
Since I needed a wildcard character that was not already defined with 
special function that didn't have the be " " on the command line, I 
experimented some and found the = sign. It works for me.

Thanks to everyone who replied.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4C18D4AE.2010606>