hints on shell string expansion ?

Luigi Rizzo rizzo at icir.org
Mon Jul 7 00:46:27 PDT 2003

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.

a2="deny log"
a3="pipe 10"

Now, this works:

	for act in "$a1" "$a2" "$a3"; do
		echo "add $act ip from to"

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 to"

I have tried to play tricks with quotes and backquotes, backslashes,
eval, etc. but no methods helped. Any ideas ?


More information about the freebsd-hackers mailing list