Hello all.

Can anyone tell me how, in a script, I can ensure a variable is treated as
base 10? I've looked at the bash man page, and found it a little (as Anand
would put it) "hard to parse".

>From the man page:

       Constants  with  a leading 0 are interpreted as octal num-
       bers.  A leading 0x or 0X denotes hexadecimal.  Otherwise,
       numbers  take  the  form [base#]n, where base is a decimal
       number between 2 and 36 representing the arithmetic  base,
       and  n is a number in that base.  If base is omitted, then
       base 10 is used.

Trouble is, I don't ever use numbers explicitely, only through variables,
and as they refer to dates, often have a leading '0', and are interpreted as
octal, so break if they are > 07. I can't seem to use any sort of
'[10#]`cut..`' or '[10#]$var'..
                                          
TIA.

-- 
Cantanker /
---------/----------------
        / [EMAIL PROTECTED]


--
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://slug.org.au/lists/listinfo/slug

Reply via email to