[pacman-dev] [PATCH] Add missing "-e" switch to Bash's "echo" command in human_to_size_test.sh

Dave Reisner d at falconindy.com
Fri Nov 8 08:43:59 EST 2013


On Nov 8, 2013 1:02 AM, "Jason St. John" <jstjohn at purdue.edu> wrote:
>
> Signed-off-by: Jason St. John <jstjohn at purdue.edu>
> ---
> Andrew pointed out that Bash's "echo" command needs the "-e" switch to
handle
> escapes, which reminded me of this.

We really should be using printf instead of echo.

>
>
>  test/scripts/human_to_size_test.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/test/scripts/human_to_size_test.sh
b/test/scripts/human_to_size_test.sh
> index 659d78c..692b89d 100755
> --- a/test/scripts/human_to_size_test.sh
> +++ b/test/scripts/human_to_size_test.sh
> @@ -5,7 +5,7 @@ declare -i testcount=0 fail=0 pass=0 total=15
>  # source the library function
>  lib=${1:-${PMTEST_SCRIPTLIB_DIR}human_to_size.sh}
>  if [[ -z $lib || ! -f $lib ]]; then
> -       echo "Bail out! human_to_size library ($lib) could not be
located\n"
> +       echo -e "Bail out! human_to_size library ($lib) could not be
located\n"

This is technically a whitespace change for the output. Is the intent here
really to have an additional newline?

>         exit 1
>  fi
>  . "$lib"
> --
> 1.8.4.2
>
>


More information about the pacman-dev mailing list