]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
command_util: Fix quoting in template_loop().
authorAndre Noll <maan@systemlinux.org>
Sun, 30 Oct 2011 11:54:32 +0000 (12:54 +0100)
committerAndre Noll <maan@systemlinux.org>
Sun, 20 Nov 2011 14:08:41 +0000 (15:08 +0100)
Without this additional quoting, the command usage string is incorrect
in case the template contains square brackets. For example, the usage
of the lsblob commands was printed as

Usage: lspl [-i] [-l] [-r] t

rather than the desired

Usage: lspl [-i] [-l] [-r] [pattern]

because the command "echo [pattern]" prints "t" since there is a
subdirectory called "t" in the source tree.

command_util.sh

index 8f82b39318103dd73b44315ddaa3548912320bbc..86e0125865fdb24ceb1b42189430e7f5d31416c5 100755 (executable)
@@ -249,11 +249,11 @@ template_loop()
        for member in $template_members; do
                local sed_cmd="sed -e s/@member@/$member/g"
                #echo "sed_cmd: $sed_cmd"
-               name_txt=$(echo $t_name | $sed_cmd)
+               name_txt=$(echo "$t_name" | $sed_cmd)
                #name_txt="$tname"
-               perms_txt=$(echo $t_perms | $sed_cmd)
-               desc_txt=$(echo $t_desc | $sed_cmd)
-               usage_txt=$(echo $t_usage | $sed_cmd)
+               perms_txt=$(echo "$t_perms" | $sed_cmd)
+               desc_txt=$(echo "$t_desc" | $sed_cmd)
+               usage_txt=$(echo "$t_usage" | $sed_cmd)
                help_txt=$(printf "%s\n" "$t_help" | $sed_cmd)
                prototype=$(echo "$template_prototype" | $sed_cmd)
                $1