From: Andre Noll Date: Sun, 30 Oct 2011 11:54:32 +0000 (+0100) Subject: command_util: Fix quoting in template_loop(). X-Git-Tag: v0.4.9~1^2~10 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=efc124e295a4df44dd4d60c856e3a3d87f645e96;ds=sidebyside 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. --- 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