On Sat, Mar 15, 2025 at 07:29:39AM +0100, Christian Schulte wrote:

> Hi @misc,
> 
> I recently stumbled upon an issue with GNU printf(1). I was using
> echo(1) in a testsuite.at on OpenBSD successfully, but that failed on
> linux badly. The OpenBSD man page of echo(1) contains this sentence:
> 
> Where portability is paramount, use printf(1).
> 
> So I replaced echo(1) with printf(1). This leads to...
> 
> OpenBSD:
> 
> x500$ printf -0
> -0x500$ printf -something
> -somethingx500$
> 
> which is the expected output. On linux I get
> 
> schulte@vps:~$ printf -0
> -bash: printf: -0: invalid option
> printf: usage: printf [-v var] format [arguments]
> schulte@vps:~$ printf -something
> -bash: printf: -s: invalid option
> printf: usage: printf [-v var] format [arguments]
> 
> Would you rate this a bug in GNU printf(1)?
> 
> -- 
> Christian
> 

No, i would rate as a usage error. Use -- to separate options form the
rest of the arguments.

print -- -0

        -Otto

Reply via email to