On Tue, 17 Nov 2026 17:43:26 -0000 (UTC), Christian Weisgerber wrote:
> Various printf(1) implementations attempt option parsing on the first
> argument and choke on something like "printf ---":
>
> FreeBSD sh(1) builtin: printf: Illegal option --
> FreeBSD standalone: printf: illegal option -- -
> bash(1) builtin: -bash: printf: --: invalid option
The GNU coreutils version prints the “---” without error.
> The workaround is to explicitly terminate option parsing with "--",
> i.e., "printf -- ---". That works at least across OpenBSD, FreeBSD,
> GNU coreutils and bash. But does it conform to POSIX?
Or how about
printf %s ---
Or just use echo and be done with it.