June 4, 2010
make money

make: *** No rule to make target `money'. Stop.

It’s not that I don’t have enough money. I live a very privileged life in this here fattest state of the fattest nation in the world.

I just don’t trust myself to do simple arithmetic — specifically for balancing my checkbook.

fancy at first

My first solution used Python’s decimal library and did the trick just fine. But then I got the wacky idea that I should take the opportunity to learn how to do decimal math with bc.

Dumb idea?

…probably

… but if that’s the case, then so was making myself learn sed and awk… which are now very much part of my daily shell scripting habits.

I use Dropbox for lazy version control — not least because I keep my data files and “code” files in the same directory for the sake of yet more laziness. My file layout looks like this:

    .
    |-- bank-balance
    |-- checkbooking*
    |-- last-done
    |-- Makefile
    |-- my-balance
    `-- outstanding

the Makefile

As seen below, the target is “last-done” and its dependencies are all of the data files — “bank-balance”, “my-balance”, and “outstanding”.

the bash + bc script

As said above, the following bash script just uses bc to do the decimal math.

And with that, I’d much appreciate it if somebody would hurry up and tell me what I’m doing wrong.

:)