convert-ebook.sh 269 B

123456789101112131415
  1. #!/usr/bin/env bash
  2. set -euo pipefail # bash strict mode
  3. display_help(){
  4. echo "Usage: ${0##*/} [epub,pdf,mobi,etc...] [file/s]"
  5. exit 2
  6. }
  7. [[ $# -lt 2 ]] && display_help
  8. ext="$1"
  9. shift
  10. for book in "$@"; do
  11. ebook-convert "$book" "${book%.*}.${ext}" -vv
  12. done