Re: Problem with using extended filename globbing in Ksh
From: Eric Haijun Xu (eric.xhj_at_gmail.com)
Date: 11/29/05
- Next message: Harry: "Re: print one occurance for duplicate entries"
- Previous message: Ed Morton: "Re: print one occurance for duplicate entries"
- In reply to: danr: "Re: Problem with using extended filename globbing in Ksh"
- Next in thread: Chris F.A. Johnson: "Re: Problem with using extended filename globbing in Ksh"
- Reply: Chris F.A. Johnson: "Re: Problem with using extended filename globbing in Ksh"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 28 Nov 2005 22:41:35 -0800
danr wrote:
> danr wrote:
> > To protect the asterisks in the assighnment, it's advisable to use
> > quotes.
> > PPPOE='DIAL_*2005@(092[2-9]|093[01]|10[01][0-9]|102[01])*'
> ....
> > eval ls "$SD$PPPOE"
> >
> As Chris Johnson pointed out, I was wrong about needing the quotes in
> your assignment statement. If your re had embedded tabs or multiple
> whitespace substrings then (of course) the quotes would be needed.
> However, I still stand by the "eval" :-)
>
> Regards,
> Dan R.
Thanks for Chris and Dan
I just do a little experiment:
---------------------------------
$ touch good bad
$ y=*
$ print $y
bad good
$ print "$y"
*
$ print ${y}
bad good
$ y=@(bad|good)
$ print $y
@(bad|good)
$ print "$y"
@(bad|good)
$ print ${y}
@(bad|good)
$ eval print "$y"
bad good
---------------------------------
There is no simple guideline for this, but if you have 'eval' to ensure
expected globbing.
- Next message: Harry: "Re: print one occurance for duplicate entries"
- Previous message: Ed Morton: "Re: print one occurance for duplicate entries"
- In reply to: danr: "Re: Problem with using extended filename globbing in Ksh"
- Next in thread: Chris F.A. Johnson: "Re: Problem with using extended filename globbing in Ksh"
- Reply: Chris F.A. Johnson: "Re: Problem with using extended filename globbing in Ksh"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]