[Ferm] String expansion in backticks

Marc Haber mh+ferm at zugschlus.de
Mon Mar 14 11:30:44 CET 2011


Hi,

I have a shell function which can be used to access a number of
interface data. For example, "ifacedata --brd eth0" will expand to a
list containing all broadcast addresses bound on eth0, while
"ifacedata --brd eth+" will expand to a list containing all broadcast
addersses of all interfaces matching the eth+ wildcard.

This has, of course, prompted the wish for something like

@def &drop_windows_broadcasts($if)={
  chain i {
    DROP daddr `ifacedata --brd $if` interface $if {
      protocol udp sport 137 dport 137;
    }
  }
}

which unfortunately doesn't work since there is no string expansion
done inside backticks. I am aware that introducing string expansion
there would open a can of worms regarding to quoting requirements if
one wants a literal $ to be passed to the command (as in the backtick
example in the manpages which calls awk '{print $2}'), so I won't ask
for string expansion to be implemented, but ...

 ... is there a different way to do things?

Greetings
Marc

-- 
-----------------------------------------------------------------------------
Marc Haber         | "I don't trust Computers. They | Mailadresse im Header
Mannheim, Germany  |  lose things."    Winona Ryder | Fon: *49 621 72739834
Nordisch by Nature |  How to make an American Quilt | Fax: *49 3221 2323190


More information about the Ferm mailing list