From ec13a838e6857585d3c3db70a0a67e337248ec28 Mon Sep 17 00:00:00 2001 From: Mohamed Akram Date: Mon, 15 Jan 2024 11:27:04 -0700 Subject: [PATCH] man: avoid unportable use of utilities echo -e is not portable. It can be replaced by printf %b (it works only with the /bin/sh built-in echo, not /bin/echo anyway). head -# is not portable, but head -n # is. Replace these two things in three places total. Signed-off-by: Mohamed Akram Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1062 --- usr.bin/man/man.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usr.bin/man/man.sh b/usr.bin/man/man.sh index 777726f880d..efb05603f91 100755 --- a/usr.bin/man/man.sh +++ b/usr.bin/man/man.sh @@ -312,7 +312,7 @@ man_check_for_so() { # We need to loop to accommodate multiple .so directives. while true do - line=$($cattool "$manpage" | head -1) + line=$($cattool "$manpage" | head -n1) case "$line" in .so*) trim "${line#.so}" decho "$manpage includes $tstr" @@ -897,11 +897,11 @@ search_whatis() { bad=${bad#\\n} if [ -n "$good" ]; then - echo -e "$good" | $MANPAGER + printf '%b\n' "$good" | $MANPAGER fi if [ -n "$bad" ]; then - echo -e "$bad" >&2 + printf '%b\n' "$bad" >&2 fi exit $rval