The printf function

Gerald S. Stoller gs_stoller at
Mon Aug 23 23:15:53 PDT 2004

I executed the following  printf  (in a  Korn shell  command-line)
		printf  't %2$s .\n'  3  55
and got the following response
	printf: illegal format character $

The following is an excerpt from the  man-3  page for  printf .

                            Each conversion specification is introduced by 
     character %.  The arguments must correspond properly (after type promo-
     tion) with the conversion specifier.  After the %, the following appear
     in sequence:

     o   An optional field, consisting of a decimal digit string followed by 
         $, specifying the next argument to access .  If this field is not
         provided, the argument following the last argument accessed will be
         used.  Arguments are numbered starting at 1.  If unaccessed 
         in the format string are interspersed with ones that are accessed 
         results will be indeterminate.

The  printf  should have produced "t 55 ." as output.
Can we please get it fixed?!?!

My system is  FreeBSD 4.3  on:
FreeBSD  4.3-RELEASE FreeBSD 4.3-RELEASE #0: Sat Apr 21 10:54:49 GMT 2001    
  jkh at  i386

Get ready for school! Find articles, homework help and more in the Back to 
School Guide!

More information about the freebsd-questions mailing list