Email List: Xaustin-group-lX
[All Lists]

Re: shell utility printf enhancement request

To: Wayne Pollock <pollock@xxxxxxx>
Subject: Re: shell utility printf enhancement request
From: Philip Guenther <guenther@xxxxxxxxx>
Date: Thu, 6 Aug 2009 01:18:12 -0700
Cc: austin-group-l@xxxxxxxxxxxxx
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=quK3elO2OIIky+ZZpo5z9JBrCX77yzbgJTt1aHjVtVI=; b=qjcuqS0wFLazdIw/vXNeuB/EVGc5b90ZgMhaRkj4LKQIe3H4O/yfuJOR/5HyC4sY5W jOEAU/o4+C8zOi7Wr2cMGca43VNZjC0+XVTmEnANmZ3KGc2WgNmaWSQEcH3rpZh6xlat yA6w8H3Zb5vXLCG86PuQs6iONAiJ1dutTrqKk=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=PlB9WSNqAYt21tK3AIIQbnIFyfqMHUrygcMXCmzS+ZqEhAUS7cKJO0GGx3/cOTgIZ/ kN145PmQj9Ghrco55U8UtqMWL8vRQIUfmb3jOKQeV393yF+2kO4Wf2nH3VA5jMHMn1iu GYHXVBRSy9B1moICeio85vRj9rNpFnl7zbdiw=
References: <4A7A15F6.3030807@acm.org>
On Wed, Aug 5, 2009 at 4:29 PM, Wayne Pollock<pollock@acm.org> wrote:
> The printf utility was designed to portably replace
> the incompatible versions of echo in use.  It does
> this admirably with one potential problem.  Printf
> is specified to take no arguments.  This is fine with
> me except I have noticed Bash shell has a built-in
> version of printf that does take arguments.
>
> I would like to see the official standard allow
> implementation-defined arguments, marked by an
> end of argument ``--''.  that is,
>
>   printf -- '%s\n' "Hello world"
>
> should be allowed and portable.  Indeed, I'd like
> to see ``--'' be allowed for all utilities that
> can take any arguments or options at all.

AFAICT, that *is* allowed and portable.  I.e., that command is
required to output "Hello world" followed by a newline.

Comparing the 'OPTIONS' section of the echo and printf command
descriptions in the standard, along with section 1.4 of this:
        http://www.opengroup.org/onlinepubs/9699919799/utilities/V3_chap01.html

may be enlightening.


Philip Guenther

<Prev in Thread] Current Thread [Next in Thread>