Displaying octal numbers in bash

Roger Oberholtzer roger
Mon May 17 11:54:05 PDT 2004


Stupid me. I did read the man page. I was just hung up on finding a format,
not a modifier. Anyway, thanks for the help.


On Thu, 25 Sep 2003 06:20:28 -0500
"David A. Bandel" <david at pananix.com> wrote:

> On Thu, 25 Sep 2003 08:40:02 +0200
> Roger Oberholtzer <roger at opq.se> wrote:
> 
> > While on the octal front, anyone know how to get the date command,
> > when used with format specifiers, NOT to prefix a number with a zero?
> > I use it in a Makefile to put a time stamp in a C program, but the
> > leading 0 forces the compiler to think it is octal. So, this month
> > '09' is not accepted. Offending are month, hour and minute. day and
> > year have a format without leading 0.
> > 
> > e.g.;
> > 
> > 	date +%m
> > 
> > gives '09'.
> 
> from the man page:
> 
>        By  default, date pads numeric fields with zeroes.  GNU date
> recognizes
>        the following modifiers between `%' and a numeric directive.
> 
>               `-' (hyphen) do not pad the field `_' (underscore) pad the
> field
>               with spaces


-- 
+????????????????????????????+???????????????????????????????+
? Roger Oberholtzer          ?   E-mail: roger at opq.se        ?
? OPQ Systems AB             ?      WWW: http://www.opq.se/  ?
? Erik Dahlbergsgatan 41-43  ?    Phone: Int + 46 8   314223 ?
? 115 34 Stockholm           ?   Mobile: Int + 46 733 621657 ?
? Sweden                     ?      Fax: Int + 46 8   302602 ?
+????????????????????????????+???????????????????????????????+



More information about the Linux-users mailing list