hints on shell string expansion ?
Luigi Rizzo
rizzo at icir.org
Mon Jul 7 00:46:27 PDT 2003
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
I have tried to play tricks with quotes and backquotes, backslashes,
eval, etc. but no methods helped. Any ideas ?
cheers
luigi
More information about the freebsd-hackers
mailing list