Number base conversions on the command line
I made some bash aliases to convert between number bases. Remember that Perl’s oct can translate the other bases as long as the input string has the prefix, such as 0b10101
:
Here are some runs:
I’ve had these forever and first posted them on a use.perl.org journal in 2008 (the binary ones were a comment from another user). I mention them in my classes and people want a place to copy them, so here they are again. The aliases tag has more of these.
At various times I’ve tried to get rid of the perl
, but I haven’t found another tool (that’s not another programming language) that can easily handle all the bases and easily take arguments. You might like to read:
Somehow the Perl solutions in those found pack instead of the easier tools such as hex designed for this.