hints on shell string expansion ?

Pawel Jakub Dawidek P.Dawidek at prioris.mini.pw.edu.pl
Mon Jul 7 01:32:00 PDT 2003


On Mon, Jul 07, 2003 at 12:46:26AM -0700, Luigi Rizzo wrote:
+> 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.
[...]
+> 	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 ?

Maybe just:

IFS='#'
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

-- 
Pawel Jakub Dawidek                       pawel at dawidek.net
UNIX Systems Programmer/Administrator     http://garage.freebsd.pl
Am I Evil? Yes, I Am!                     http://cerber.sourceforge.net


More information about the freebsd-hackers mailing list