Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 Jul 2003 10:31:49 +0200
From:      Pawel Jakub Dawidek <P.Dawidek@prioris.mini.pw.edu.pl>
To:        Luigi Rizzo <rizzo@icir.org>
Cc:        hackers@freebsd.org
Subject:   Re: hints on shell string expansion ?
Message-ID:  <20030707083149.GC2199@prioris.mini.pw.edu.pl>
In-Reply-To: <20030707004626.B56037@xorpc.icir.org>
References:  <20030707004626.B56037@xorpc.icir.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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@dawidek.net
UNIX Systems Programmer/Administrator     http://garage.freebsd.pl
Am I Evil? Yes, I Am!                     http://cerber.sourceforge.net



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030707083149.GC2199>