ksh and hex numbers

typeset -i A=16#0
typeset -u A=$a
y=${A#16#}

This converted $a to hex and stored it in y.

Can someone walk me through how this was done?

thanks

The prefix "NNN#" in front of a number indicates the numeric base. From the ksh man page:

The typeset options are "-i" for "integer", and "-u" for "uppercase". But, since A was already typed as a hex integer, $a was converted.

The final step removes the leading base indicator. If you echo a constant that is not base 10, the base is printed.

# x=123:abc
# echo ${x#123:}        # trim from the left
ABC
# echo ${x%:ABC}        # trim from the right
123

thanks a lot