I can never remember the syntax to convert numbers between various bases with bc, and end up looking at the man page.
Here is an example of using bc to convert a hex number to binary.
bash$ bc
bc 1.06
Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
ibase=F
obase=2
01EA
110111101
Technorati Tags: bc
I think your use of "ibase=F" is a little weird, since bc defaults to base 10, it should be "ibase=16". Anyway, I've turned something similar into a bash function:
ReplyDeletefunction hextobin() {
bc
Um, looks my comment got truncated. Here's what I meant:
ReplyDeletefunction hextobin() {
bc
Grr. Truncated again.
ReplyDelete<<<
How's that work?
I have removed a plugin that was supposed to make urls linkable. I think that was screwing things up
ReplyDelete