arithmetic-syntax
Bash integer base notation
Selects an explicit base from 2 through 64. Leading zero denotes octal; 0x denotes hexadecimal. Validate and bound external decimal input before using 10#.
Formal Syntax & Structure
bash syntaxbash
base#digitsReturn Value
integer
Selects an explicit base from 2 through 64. Leading zero denotes octal; 0x denotes hexadecimal. Validate and bound external decimal input before using 10#.
Working Example
Example Snippetbash
printf '%s\n' "$(( 010 ))" "$(( 0x10 ))" "$(( 2#101 ))" "$(( 10#08 ))"