bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: printf(1) Info page cause for long thought


From: Paul Jarc
Subject: Re: printf(1) Info page cause for long thought
Date: Mon, 11 Feb 2002 11:23:58 -0500
User-agent: Gnus/5.090006 (Oort Gnus v0.06) Emacs/20.7 (i386-redhat-linux-gnu)

Dan Jacobson <address@hidden> wrote:
> $ /usr/bin/printf %c 54
> 5$ /usr/bin/printf %c , 54
> ,5$ /usr/bin/printf '"%c"' , 54
> ",""5"$ 
>
> doesn't seem too similar to printf(3) here.

The corresponding use of printf(3) would be:
printf("\"%c\"", ',');
printf("\"%c\"", '5');

> I want the 54th ASCII character emitted.

See below.  The standard defining the printf command doesn't seem to
provide a direct way to do this.

> The quoting biz is different too...

How so?  What did you expect to be different?

> |argument is re-used as necessary to convert all of the given
> |ARGUMENTs.
>
> add examples.

Experimentation is your friend.
$ printf '%s %d\n' foo 1 bar 2 baz 3

> |   `printf' has one additional directive, `%b', which prints its
> |argument string with `\' escapes interpreted in the same way as in the
> |FORMAT string.
>
> I seemed to have burned out those exact brain cells I needed to
> understand this phrase somewhere in my youth.  add examples.

Experimentation is your friend.
$ printf '%b' 'foo\tbar\n'
$ printf '%b\n' "\\x$(printf %x 54)"

> |   An additional escape, `\c', causes `printf' to produce no further
> |output.
>
> Can we have some action shots of this in action on the new Info page?

Experimentation is your friend.
$ printf '%d\n\cfoo\n' 1 2 3


paul



reply via email to

[Prev in Thread] Current Thread [Next in Thread]