Writing, publishing, geekdom, and errata.

Using epubcheck on Linux

No comments
technology.pngJust a couple of quick notes to make your time with epubcheck a little bit nicer - at least, if you're on a linux system.

This makes use of zenity (of course) and the tee command, which I'm just learning - and liking!

If you've ever seen a screen of epubcheck errors, it's a huge scrolling mash of stuff that just fills pages and pages of terminal screen. Sometimes - especially if I made an error that impacts all the files in a book - it scrolls so far that I can't see all of them.

This fixes that.

You can't just do a standard redirection - if there's an error, it goes to standard error, not standard output. So this command is necessary:


java -jar /path/to/epubcheck-1.2.jar "$1" 2>&1


This is meant to be part of a bash script, so "$1" is the full path to the file in question. The funky bit there at the end will make standard error into standard output, so you can pipe it to something like zenity:


java -jar /path/to/epubcheck-1.2.jar "$1" 2>&1| zenity --text-info --width 530 --height 250


But that doesn't help us if we want a log of our errors, right?

#!/bin/bash

java -jar /path/to/epubcheck-1.2.jar "$1" 2>&1| tee >(zenity --text-info --width 530 --height 250) >logfile.log


And there you go! A logfile AND a nice zenity window full of your errors!

No comments :