diff options
-rwxr-xr-x | kickstart-static64.sh | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/kickstart-static64.sh b/kickstart-static64.sh index d85d5128d1..963161a601 100755 --- a/kickstart-static64.sh +++ b/kickstart-static64.sh @@ -94,6 +94,19 @@ run_failed() { printf >&2 "${TPUT_BGRED}${TPUT_WHITE}${TPUT_BOLD} FAILED ${TPUT_RESET} ${*} \n\n" } +ESCAPED_PRINT_METHOD= +printf "%q " test >/dev/null 2>&1 +[ $? -eq 0 ] && ESCAPED_PRINT_METHOD="printfq" +escaped_print() { + if [ "${ESCAPED_PRINT_METHOD}" = "printfq" ] + then + printf "%q " "${@}" + else + printf "%s" "${*}" + fi + return 0 +} + run_logfile="/dev/null" run() { local user="${USER:-}" dir="${PWD}" info info_console @@ -108,11 +121,11 @@ run() { fi printf >> "${run_logfile}" "${info}" - printf >> "${run_logfile}" "%q " "${@}" + escaped_print >> "${run_logfile}" "${@}" printf >> "${run_logfile}" " ... " printf >&2 "${info_console}${TPUT_BOLD}${TPUT_YELLOW}" - printf >&2 "%q " "${@}" + escaped_print >&2 "${@}" printf >&2 "${TPUT_RESET}\n" "${@}" |