From 8e71ef57001c4675c76c28983cdecf9b08324571 Mon Sep 17 00:00:00 2001 From: Sérgio M. Basto Date: Apr 25 2023 07:02:58 +0000 Subject: Replace `echo -e` with `printf` From 9e651c3fa43ce4d7e89b3390153e2dcd889c9b8d Mon Sep 17 00:00:00 2001 From: Denton Liu Date: Tue, 13 Dec 2022 23:26:37 -0800 This script uses `#!/bin/sh` as its shebang, which means it expects a POSIX-compliant shell. However, it also uses `echo -e` which is not POSIX-compliant[0]. Rewrite `echo -e "$arg"` invocations to `printf "$arg\\n"` so that the script is brought into POSIX compliance. [0]: https://pubs.opengroup.org/onlinepubs/009604599/utilities/echo.html [1]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/printf.html --- lsb_release/src/lsb_release | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) --- diff --git a/lsb-release-2.0/lsb_release b/lsb-release-2.0/lsb_release index 9d7afbc..c870690 100755 --- a/lsb-release-2.0/lsb_release +++ b/lsb-release-2.0/lsb_release @@ -289,7 +289,7 @@ GetDistribInfo() { DisplayVersion() { if [ -z "$ARG_S" ] then - echo -e "$MSG_LSBVER$LSB_VERSION" # at least "n/a" + printf "$MSG_LSBVER$LSB_VERSION\\n" # at least "n/a" else MSG_RESULT="$MSG_RESULT${MSG_RESULT:+ }$LSB_VERSION" fi @@ -313,7 +313,7 @@ DisplayID() { fi if [ -z "$ARG_S" ] then - echo -e "$MSG_DISTID$DISTRIB_ID" + printf "$MSG_DISTID$DISTRIB_ID\\n" else MSG_RESULT="$MSG_RESULT${MSG_RESULT:+ }$DISTRIB_ID" fi @@ -328,7 +328,7 @@ DisplayDescription() { fi if [ -z "$ARG_S" ] then - echo -e "$MSG_DISTDESC$DISTRIB_DESCRIPTION" + printf "$MSG_DISTDESC$DISTRIB_DESCRIPTION\\n" else MSG_RESULT="$MSG_RESULT${MSG_RESULT:+ }\"$DISTRIB_DESCRIPTION\"" fi @@ -346,7 +346,7 @@ DisplayRelease() { fi if [ -z "$ARG_S" ] then - echo -e "$MSG_DISTREL$DISTRIB_RELEASE" + printf "$MSG_DISTREL$DISTRIB_RELEASE\\n" else MSG_RESULT="$MSG_RESULT${MSG_RESULT:+ }$DISTRIB_RELEASE" fi @@ -364,8 +364,8 @@ DisplayCodename() { fi if [ -z "$ARG_S" ] then - echo -e "$MSG_DISTCODE$(echo "$DISTRIB_CODENAME" | \ - tr -d "[:blank:]")" # Remove blanks + printf "$MSG_DISTCODE$(echo "$DISTRIB_CODENAME" | \ + tr -d "[:blank:]")\\n" # Remove blanks else MSG_RESULT="$MSG_RESULT${MSG_RESULT:+ }$(echo "$DISTRIB_CODENAME" | \ tr -d "[:blank:]")"