From c4d045b597703ec53f56c6397d2e1f58f960ff41 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Thu, 02 Aug 2012 07:30:17 -0400 Subject: Prevent field splitting on usage and help strings. --- diff --git a/lib/messages.sh b/lib/messages.sh index 597ceaf..ab1533b 100644 --- a/lib/messages.sh +++ b/lib/messages.sh @@ -54,22 +54,34 @@ oh_info() oh_usage() { _util="$(echo "${0##*/}" | sed 's/-/_/g')" + + # Prevent field splitting in the evaluated echo command. + _old_ifs="${IFS}" + IFS= _usage_str="$(eval echo \$\{oh_str_usage_"${_util}"\})" + IFS="${_old_ifs}" + : "${_usage_str:=${oh_str_usage_none}}" printf '%s\n' "${_usage_str}" } oh_help() { - oh_usage _util="$(echo "${0##*/}" | sed 's/-/_/g')" + + # Prevent field splitting in the evaluated echo command. + _old_ifs="${IFS}" + IFS= _help_str="$(eval echo \$\{oh_str_help_"${_util}"\})" + IFS="${_old_ifs}" : "${_help_str:=${oh_str_help_none}}" + + oh_usage printf '%s\n' "${_help_str}" } oh_version() { printf "${oh_str_version}\n" \ - "${0##*/}" '@@package_name@@' '@@package_version@@' + "${0##*/}" '@@PACKAGE_NAME@@' '@@PACKAGE_VERSION@@' } -- cgit v0.9.1