From f015d37c0697b6ace0cf128b16747ffb0ab98198 Mon Sep 17 00:00:00 2001 From: Alain Reguera Delgado Date: May 22 2011 00:35:21 +0000 Subject: Update Functions/cli_printMessage.sh. --- diff --git a/Scripts/Functions/cli_printMessage.sh b/Scripts/Functions/cli_printMessage.sh index 69b5977..cb0d276 100755 --- a/Scripts/Functions/cli_printMessage.sh +++ b/Scripts/Functions/cli_printMessage.sh @@ -142,8 +142,13 @@ function cli_printMessage { ;; --as-error-line ) - # This option is used to print error messsages. - echo "${CLI_PROGRAM} ($(caller 1 | gawk '{ print $2 " " $1 }')): ${MESSAGE}" > /dev/stderr + # Define where the error was originated inside the + # centos-art.sh script. Print out the function name and + # line from the caller. + local ORIGIN="${CLI_PROGRAM} ($(caller 1 | gawk '{ print $2 " " $1 }'))" + + # Build the error message. + cli_printMessage "${ORIGIN}: ${MESSAGE}" --as-stderr-line cli_printMessage "${FUNCDIRNAM}" --as-toknowmore-line ;; @@ -198,16 +203,20 @@ function cli_printMessage { echo "$MESSAGE" ;; + --as-stderr-line ) + echo "$MESSAGE" > /dev/stderr + ;; + * ) echo "$MESSAGE" \ | awk 'BEGIN { FS=": " } { - if ( $0 ~ /^-+$/ ) + if ( $0 ~ /^-+$/ ) print $0 else - printf "%-15s\t%s\n", $1, $2 - } - END {}' > /dev/stderr + printf "%-15s\t%s\n", $1, $2 + } + END {}' > /dev/stderr ;; esac