From efc124e295a4df44dd4d60c856e3a3d87f645e96 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sun, 30 Oct 2011 12:54:32 +0100 Subject: [PATCH] command_util: Fix quoting in template_loop(). 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 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/command_util.sh b/command_util.sh index 8f82b393..86e01258 100755 --- a/command_util.sh +++ b/command_util.sh @@ -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 -- 2.39.5