#!/usr/bin/env bash set -e function cleanup { fusermount -u "$library" rm -rf "$library" } if [ -z "$1" ]; then echo "USAGE: $0 host:path" exit 1 fi library=$(mktemp -p /tmp -d calibre-remote.XXXXXXXXXX) sshfs "$1" "$library" trap cleanup EXIT INT TERM calibre --with-library="$library"