Bash + How to add Hexadecimal numbers
Hi all,
How do you add two hexadecimal numbers together in bash? I have looked all over google and could not find an answer. Thanks, trscookie. |
Code:
# echo $((0xA + 1)) |
hi, thanks for a super speedy response but the answer is in decimal, how do you get the answer in hex?
|
You can use "bc".
Code:
$ bc -l |
Getting the wrong result????:
Code:
adrian@adrians-laptop:~$ bc -l shouldn't the answer be a2? Am I doing something wrong here? Thanks. |
Quote:
Code:
# var=$((0xA + 1)) |
Sorry, just realised that it is case sensitive, thanks for all of your help. trscookie
|
Quote:
|
All times are GMT -5. The time now is 08:58 AM. |