X-Git-Url: http://git.projectaon.org/?p=project-aon.git;a=blobdiff_plain;f=common%2Fscripts%2Flist-book-info.sh;fp=common%2Fscripts%2Flist-book-info.sh;h=4d9473c41a249af330177c835a61a473268fddbe;hp=0000000000000000000000000000000000000000;hb=600bebceef75b28a2e0a4723e09df73c179d66a8;hpb=7d3e9ca54e0cb51922b34659b920e61ee3a6e8d2 diff --git a/common/scripts/list-book-info.sh b/common/scripts/list-book-info.sh new file mode 100755 index 0000000..4d9473c --- /dev/null +++ b/common/scripts/list-book-info.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env bash +# +# List all book into that match given bookcode(s). If the bookcode is omitted, +# outputs data for all books. +# +# Examples: +# list-book-info.sh lw gs +# +# list-book-info.sh + +if [ ! -d "$AONDIR" ]; then + >&2 echo "Please set the AONDIR environment variable" + exit 1 +fi + +book_db="$AONDIR/common/sqlite/bookcodes.db" + +if [ -z "$1" ]; then + sqlite3 -column -noheader "$book_db" <&2 echo "invalid book code" + exit + fi + + sqlite3 -column -noheader "$book_db" <