Re: Problem with using extended filename globbing in Ksh

From: Chris F.A. Johnson (cfajohnson_at_gmail.com)
Date: 11/28/05


Date: Mon, 28 Nov 2005 02:21:03 -0500

On 2005-11-28, Eric Haijun Xu wrote:
> #----------------- the script ------------------
> SD='/mA/billing2/USAGE/Ready/'
> PPPOE=DIAL_*2005@(092[2-9]|093[01]|10[01][0-9]|102[01])*
>
> # the first ls
> ls
> /mA/billing2/USAGE/Ready/DIAL_*2005@(092[2-9]|093[01]|10[01][0-9]|102[01])*
> # the second ls
> ls "$SD""$PPPOE"
> # ------------- the end --------------------
>
> "the first ls" works
> "the second ls" does not work. My guess is that shell deems it has done
> its job after expanding $SD and $PPPOE and does not take a look at the
> expanded output.

   Wildcards are not expanded on assignment, nor when quoted. Try:

ls "$SD"$PPPOE

-- 
   Chris F.A. Johnson, author   |    <http://cfaj.freeshell.org>
   Shell Scripting Recipes:     |  My code in this post, if any,
   A Problem-Solution Approach  |          is released under the
   2005, Apress                 |     GNU General Public Licence