From 4f303b048743f494a79916a0a30ecb3b027164b7 Mon Sep 17 00:00:00 2001 From: Guillaume Castagnino Date: Fri, 16 Jan 2015 12:57:15 +0100 Subject: fix https://bugs.gentoo.org/show_bug.cgi?id=536758 The shill version of shell_var is not correctly escaping vars --- sh/functions.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'sh') diff --git a/sh/functions.sh b/sh/functions.sh index 368bb73..d82d72a 100644 --- a/sh/functions.sh +++ b/sh/functions.sh @@ -33,11 +33,14 @@ if [ -z "$(command -v service_set_value >/dev/null 2>&1)" ]; then } shell_var() { - local output=$1 sanitized_arg= - shift 1 + local output= sanitized_arg= for arg; do sanitized_arg="${arg//[^a-zA-Z0-9_]/_}" - output="$output $arg" + if [ x"$output" = x"" ] ; then + output=$sanitized_arg + else + output="$output $sanitized_arg" + fi done echo "$output" } -- cgit v1.2.3-65-gdbad