Skip to content

Commit 9e651c3

Browse files
committed
Replace echo -e with printf
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
1 parent 3cf5103 commit 9e651c3

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

lsb_release/src/lsb_release

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ GetDistribInfo() {
299299
DisplayVersion() {
300300
if [ -z "$ARG_S" ]
301301
then
302-
echo -e "$MSG_LSBVER$LSB_VERSION" # at least "n/a"
302+
printf "$MSG_LSBVER$LSB_VERSION\\n" # at least "n/a"
303303
else
304304
MSG_RESULT="$MSG_RESULT${MSG_RESULT:+ }$LSB_VERSION"
305305
fi
@@ -323,7 +323,7 @@ DisplayID() {
323323
fi
324324
if [ -z "$ARG_S" ]
325325
then
326-
echo -e "$MSG_DISTID$DISTRIB_ID"
326+
printf "$MSG_DISTID$DISTRIB_ID\\n"
327327
else
328328
MSG_RESULT="$MSG_RESULT${MSG_RESULT:+ }$DISTRIB_ID"
329329
fi
@@ -338,7 +338,7 @@ DisplayDescription() {
338338
fi
339339
if [ -z "$ARG_S" ]
340340
then
341-
echo -e "$MSG_DISTDESC$DISTRIB_DESCRIPTION"
341+
printf "$MSG_DISTDESC$DISTRIB_DESCRIPTION\\n"
342342
else
343343
MSG_RESULT="$MSG_RESULT${MSG_RESULT:+ }\"$DISTRIB_DESCRIPTION\""
344344
fi
@@ -356,7 +356,7 @@ DisplayRelease() {
356356
fi
357357
if [ -z "$ARG_S" ]
358358
then
359-
echo -e "$MSG_DISTREL$DISTRIB_RELEASE"
359+
printf "$MSG_DISTREL$DISTRIB_RELEASE\\n"
360360
else
361361
MSG_RESULT="$MSG_RESULT${MSG_RESULT:+ }$DISTRIB_RELEASE"
362362
fi
@@ -374,8 +374,8 @@ DisplayCodename() {
374374
fi
375375
if [ -z "$ARG_S" ]
376376
then
377-
echo -e "$MSG_DISTCODE$(echo "$DISTRIB_CODENAME" | \
378-
tr -d "[:blank:]")" # Remove blanks
377+
printf "$MSG_DISTCODE$(echo "$DISTRIB_CODENAME" | \
378+
tr -d "[:blank:]")\\n" # Remove blanks
379379
else
380380
MSG_RESULT="$MSG_RESULT${MSG_RESULT:+ }$(echo "$DISTRIB_CODENAME" | \
381381
tr -d "[:blank:]")"

0 commit comments

Comments
 (0)