# shellcheck disable=SC2016 # $((base#digits)), as ksh and bash accept it; an out-of-range base is an error. "$TSH" -c 'echo $((16#ff)) $((2#1010)) $((36#z)) $((8#17))' "$TSH" -c 'echo $((10#08))' "$TSH" -c 'echo $((1#0))' >/dev/null 2>err echo "rc=$?" sed 's/^[^:]*: line [0-9]*: //' err # A base too large to be a base, a missing digit, and a digit the base # does not have are errors, not an overflow trap: the base is built with a # bound and every digit is validated against the base. for e in '99999999999999999999#1' '16# f' '16#0x10' '2#2' \ '36#zzzzzzzzzzzzzz' '16#'; do "$TSH" -c "echo \$(($e))" >/dev/null 2>err echo "rc=$?" sed 's/^[^:]*: line [0-9]*: //' err done # ksh's digit set: 10-35 are a-z, 36-61 are A-Z, 62 is '@', 63 is '_'. "$TSH" -c 'echo $((64#z)) $((64#_)) $((64#Z)) $((64#@))'