C programmers know about assert(3), a macro to verify that some condition is true at run time. It is meant for detecting errors in the program logic.

Sometimes a similar thing would be useful at the command line. Thus, I wrote a command line program to assert that various conditions are true. My immediate use case for this is to verify that all KVM virtual machine images on a server of mine are of the qcow2 type. I had a case where one of them was of a different type, and this causes some headaches. Now I can write a crontab entry that verifies the types. If something breaks, I will get e-mail about it.

This is still extremely pre-alpha. Anything might change. Nothing is documented.


assert equal $USER root
assert mime-type-is application/x-qemu-qcow2 /srv/vm/*.img

I'll flesh this out, and write a manpage and everything, if this turns out to be a good idea.



  • The .deb should have a cron.daily file that runs scripts in /etc/sh-assert.d, using run-parts.
  • Write manual page.
  • Find out if there's another assert(1) out there somewhere.