From af13f4d4c1456b4c43676d4fda8e712bb0717b2d Mon Sep 17 00:00:00 2001 From: teastep Date: Sun, 10 Dec 2006 03:13:54 +0000 Subject: [PATCH] Update 'strip' to use better algorithm git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@5076 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- Shorewall/strip | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Shorewall/strip b/Shorewall/strip index 2814b9ea0..d11429dcd 100755 --- a/Shorewall/strip +++ b/Shorewall/strip @@ -21,9 +21,16 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA # +############################################################################### +# Filter that expands variables # -# Perform variable substitution on the passed argument and echo the result -# +expand_line() { + local line + + while read line; do + echo $(expand $line) + done +} # # Read a file and handle "INCLUDE" directives @@ -42,7 +49,7 @@ read_file() # $1 = file name, $2 = nest count echo " WARNING: INCLUDE in $1 ignored (nested too deeply)" >&2 fi else - eval echo \"$first $rest\" + eval "$first $rest" fi done < $1 else @@ -92,7 +99,7 @@ if [ ! -f $TMP_DIR/$1 ]; then [ $# = 1 ] && fname=$(find_file $1) || fname=$2 if [ -f $fname ]; then - read_file $fname 0 | cut -d'#' -f1 | grep -v '^[[:space:]]*$' > $TMP_DIR/$1 + read_file $fname 0 | cut -d'#' -f1 | grep -v '^[[:space:]]*$' | expand_line > $TMP_DIR/$1 else > $TMP_DIR/$1 fi