Re: nonconformant behavior for printf(1) (you cannot interpret - as an o
From:
Eric Blake
Subject:
Re: nonconformant behavior for printf(1) (you cannot interpret - as an option char)
Date:
Mon, 26 Nov 2007 21:37:49 -0700
User-agent:
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071031 Thunderbird/2.0.0.9 Mnenhy/0.7.5.666
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
According to Rich Felker on 11/26/2007 8:43 PM:
> $ printf ---%s---\\n test
> bash: printf: --: invalid option
That's not a bug. If you insist on printing with a format string that
starts with -, POSIX requires that you use -- to end arguments, as in:
$ printf -- ---%s---\\n test
- ---test---
If your non-builtin system printf behaves differently, that is a bug in
your system printf.
- --
Don't work too hard, make some time for fun as well!
Eric Blake ebb9@byu.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHS58d84KuGfSFAYARAl6uAKCiyJwxJxwt3pEoIBoOtzAgMAPfdwCdGLk5
5seJo0RZaa7EWH8lcWbvaMU=
=5gil
-----END PGP SIGNATURE-----