RE: [OT] Strange bash phenomenon

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2006-02-13 at 10:50 -0500, Pablo Sanchez wrote:
> > -----Original Message-----
> > From: netfilter-bounces@xxxxxxxxxxxxxxxxxxx
> > [mailto:netfilter-bounces@xxxxxxxxxxxxxxxxxxx]On Behalf Of John A.
> > Sullivan III
> > Sent: Saturday, February 11, 2006 8:45 AM
> > To: Netfilter users list
> > Subject: [OT] Strange bash phenomenon
> > 
> > Case #1
> > -------
> > FILES=/etc/config/iptables*
> >
> > [ snipped ]
> >
> > Case #2
> > -------
> > FILES=$(echo /etc/config/iptables*)
> > 
> > Any ideas why the latter one works fine but the other does not? Just
> > curious.
> 
> Hi John,
> 
> It has to do when the shell does the expansion.  In the first case when you assign 'FILES=', you're assigning it the string and it's not expanded by the shell.  If you want to change the behavior, you can do this:
> 
> 	FILES=${/etc/config/iptables*}
> 
> btw, Ilove the ${FILES%% *} trick.  I didn't know about it.  The shell is quite nifty.
> 
> -pablo
> 
> 
Thanks.  That makes sense, i.e., unexpanded assignment.  By the way, if
I try FILES=${/iptables*}, I get:

./testbash2: line 2: ${testb*}: bad substitution

But, at least I know how to make it work and understand why the first
approach failed - John
-- 
John A. Sullivan III
Open Source Development Corporation
+1 207-985-7880
jsullivan@xxxxxxxxxxxxxxxxxxx

Financially sustainable open source development
http://www.opensourcedevel.com



[Index of Archives]     [Linux Netfilter Development]     [Linux Kernel Networking Development]     [Netem]     [Berkeley Packet Filter]     [Linux Kernel Development]     [Advanced Routing & Traffice Control]     [Bugtraq]

  Powered by Linux