Re: [announce] Small skarnet.org update

From: Laurent Bercot <ska-skaware_at_skarnet.org>
Date: Fri, 11 Mar 2022 11:56:54 +0000

>Why not use printf %s\\n "$maybe_begins_with_dash" instead of s6-echo?

- Not all systems provide printf. I know it's in POSIX, but I've worked
on many embedded systems that didn't have it. And not all containers
have
a full set of coreutils.
- It's more complex and thus slower and more error-prone, even by a
tiny amount. You shouldn't need to think about how many backslashes
you're gonna need to write a newline when all you want is print a
goddamn string to stdout.
- I personally dislike anything involving the C printf() function, for
reasons that I don't want to go into today (I've ranted enough about it
on the IRC channel).

  All in all, these arguments are pretty weak, so you can absolutely
use printf if you want to, but they were enough for me to bite the
bullet and write an echo command I could rely on. (Not that it was
very hard to do.)

--
  Laurent
Received on Fri Mar 11 2022 - 12:56:54 CET

This archive was generated by hypermail 2.4.0 : Fri Mar 11 2022 - 12:57:23 CET