When you need a simple calculation, you do not want to use the GUI calculator, can be directly calculated under the shell is the best
Checked, there is a thing called BC, the specific use will not repeat, you can run BC, and then go into the calculation, you can echo the past, probably like this
Echo " 1+2 " | BC Echo " ibase=16;1a+1 " | Bc
However, it is not easy to use, the first is to specify the system, so that the entire expression is this type of, for example
Echo " ibase=16;1a*10 " | BC 0x1A0x10
But I think it would be more troublesome to calculate the 0x1a multiplied by 10 in 10.
If you can have a hybrid into the calculator, think of the fact that you can also package a, as long as the expression, and then the non-10 binary numbers are converted to 10, and then pass the processed expression to the BC, it should be OK.
So, wrote a script, put on GitHub, need to visit HTTPS://GITHUB.COM/ZQB-ALL/SMARTBC
After downloading, you need to add executable permissions, and then link to the place where your environment variables are found
Like what
chmod +x smartbcsudoln -S 'pwd'/SMARTBC /USR/BIN/SMARTBC
or an individual name.
sudo Ln -S 'pwd'/SMARTBC /USR/BIN/MYBC
And then you can use it, just look at the help.
Smartbc-h
This article links http://www.cnblogs.com/zqb-all/p/6793917.html
Shell command line hybrid binary calculator