From f2cc869d16fa4821978508bc606c911b37b1a53b Mon Sep 17 00:00:00 2001 From: Alain Reguera Delgado Date: May 08 2011 14:48:11 +0000 Subject: Update cli_printMessage.sh: - Remove the verification about "first argument required". There is no specific order when retriving non-option arguments from the positional parameters because we are using getopt to retrive them. - On the `--as-response-line' option, do not use `cli_printMessage' to print the message line. Here, the message string contains the character `-' which is used by getopt to identify option arguments. Using any `-' sign in the message itself may confuse getopt or provoke centos-art.sh to report an error. This is a limitation we are facing right now. It is not possible to use `-' in the message side because the whole ARGUMENT string is passed to getopt and we cannot escape them either (as we did with the apostrophe character) because that would escape real options too and would suppress the whole idea of using getopt. To workaround this issue, use `echo' command instead of cli_printMessage to print `--as-response-line' messages and redirect the `echo' output to the standard error output. --- diff --git a/Scripts/Functions/cli_printMessage.sh b/Scripts/Functions/cli_printMessage.sh index 789de6b..66cf3d6 100755 --- a/Scripts/Functions/cli_printMessage.sh +++ b/Scripts/Functions/cli_printMessage.sh @@ -31,12 +31,6 @@ function cli_printMessage { return fi - # Verify number of positional parameters. The first argument is - # required. - if [[ $# -eq 0 ]];then - cli_printMessage "`gettext "The first argument is required."`" --as-error-line - fi - # Define short options. local ARGSS='' @@ -195,7 +189,7 @@ function cli_printMessage { ;; --as-response-line ) - cli_printMessage "--> $MESSAGE" + echo "--> $MESSAGE" > /dev/stderr shift 2 break ;;