🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.shell
Article #396

Re: POSIX: printf ---?

#396
From: Lawrence D’Oliveiro
Date: Tue, 17 Nov 2026 21:37
20 lines
1862 bytes
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.
Technical Details
Message-ID: <11dihf5$q0gg$2@dont-email.me>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
References: <slrn11fp4hu.sql.naddy@lorvorc.mips.inka.de>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: Lawrence D’Oliveiro <ldo@nz.invalid>
Newsgroups: comp.unix.shell
Subject: Re: POSIX: printf ---?
Date: Tue, 17 Nov 2026 21:37:41 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 20
Message-ID: <11dihf5$q0gg$2@dont-email.me>
References: <slrn11fp4hu.sql.naddy@lorvorc.mips.inka.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 17 Nov 2026 21:37:42 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="852496"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19uF42Q8x4MnK8R5E0oMhyC"; posting-host="b870de88fe80d6f89f8bff91e4fbc8e6"
User-Agent: Pan/0.165 (Kostiantynivka)
Cancel-Lock: sha1:7SdMIldrv2iCx4bvSDDGQ8t8XQg= sha256:ifdApTHag7KAf/l7LAeABx7SgRfqOLELnqFKBCUb/CU=
	sha1:YGfp0rOg1Jmx0hJvY+sprBgJPqg= sha256:p+if+IwTocadPy/dyfhGh7XLrcsspkqdsFHSpO34j8o=