On Mon, Jul 07, 2003 at 12:46:26AM -0700, Luigi Rizzo wrote: > Hi, > i need a bit of help from creative /bin/sh users... > > I am writing a script to generate ipfw test cases, and as > part of the script i need to generate 'actions' which can be either > one or more, e.g. > > a1="allow" > a2="deny log" > a3="pipe 10" > > Now, this works: > > for act in "$a1" "$a2" "$a3"; do > echo "add $act ip from 1.2.3.4 to 5.6.7.8" > done > > but i because the string of actions is used in several places, > I would love to find a way to group actions into a single > variable and then write something like this > > actions="allow 'deny log' 'pipe 10'" > for act in $actions ; do > echo "add $act ip from 1.2.3.4 to 5.6.7.8" > done
Isn't this what you want ? $ set allow "deny log" "pipe 10" $ for act in "$@"; do echo "<$act>"; done <allow> <deny log> <pipe 10> Regards, Adi _______________________________________________ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"