bash error

ken_i_m at ken_i_m at
Sun Nov 28 15:28:13 PST 2004

On Sun, Nov 28, 2004 at 10:42:55AM -0700, Kevin P. Fleming (kpfleming at wrote:
> ken_i_m at wrote:
> >I am beginning to suspect that this is a dark corner of bash and that is
> >why I have not found any docs that do a good job of describing it.
> >Pointers and application of cluestick greatly appreciated.
> Simple: numeric values that start with 0 (zero) and consist of only 
> digits 0-7 are considered to be octal, and interpreted that way. When 
> the string contains an 8 or a 9 (which will always be at the end of your 
> example, since only the minutes could contain them), then it will be 
> treated as decimal.
> Prefixing the string with "10#" should force it to be always be 
> interpreted in base-10 (i.e. decimal).

Reading the manpage again - see "Shell Arithmetic"

I take a stab in the dark with:

  let foo=10#048
  echo $foo

and I appear to get the correct result.  However, it is a useless
statement.  Going back to how I got here:

  let t_stamp=`date +%H%M`

edit to

  let t_stamp=(10#`date +%H%M`)

does not result in an error message.  Adjusting the date to the midnight
hour on a test box this appears to work.  Cool.

I reason and act, therefore, ken_i_m
Chief Gadgeteer, Elegant Innovations
Founder, Bozeman Linux Users Group
(406) 581-0495

More information about the lfs-chat mailing list