From ca3f3fe68ae72fec6f607278bf88d30ab1497627 Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Fri, 25 Mar 2022 15:43:47 +0100 Subject: change echo to printf and for sfeed_opml_export use a control-character separator echo is unportable in this way and names containing characters like an option (-n) or backslash or escape codes (\e, \n, etc) could be messy. For awk set LC_ALL=C for simple collation. This makes sfeed_opml_export slower in some shells that don't have printf builtin though. For example with about 150 feeds in a config file it is a bit slower on OpenBSD ksh. time ./sfeed_opml_export | wc -l 152 0m00.29s real 0m00.05s user 0m00.20s system time sfeed_opml_export | wc -l 152 0m00.02s real 0m00.00s user 0m00.03s system --- sfeed_update | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sfeed_update') diff --git a/sfeed_update b/sfeed_update index 2e54a59..857f537 100755 --- a/sfeed_update +++ b/sfeed_update @@ -27,7 +27,7 @@ loadconfig() { if [ -r "${path}" ]; then . "${path}" else - echo "Configuration file \"${config}\" cannot be read." >&2 + printf "Configuration file \"%s\" cannot be read.\n" "${config}" >&2 echo "See sfeedrc.example for an example." >&2 exit 1 fi @@ -187,7 +187,7 @@ sighandler() { } feeds() { - echo "Configuration file \"${config}\" is invalid or does not contain a \"feeds\" function." >&2 + printf "Configuration file \"%s\" is invalid or does not contain a \"feeds\" function.\n" "${config}" >&2 echo "See sfeedrc.example for an example." >&2 } -- cgit v1.2.3