X-Git-Url: http://git.projectaon.org/?p=project-aon.git;a=blobdiff_plain;f=common%2Fscripts%2Flist-bookcodes-by-lang.sh;fp=common%2Fscripts%2Flist-bookcodes-by-lang.sh;h=edf62bfbbf3a3477bf79257789b4167fb549fba4;hp=0000000000000000000000000000000000000000;hb=c6338dc3c2d3299fdf71c128a7b707d7a69762dd;hpb=2bad6d7f32882c37e0ced713ce64832a519f4b47 diff --git a/common/scripts/list-bookcodes-by-lang.sh b/common/scripts/list-bookcodes-by-lang.sh new file mode 100755 index 0000000..edf62bf --- /dev/null +++ b/common/scripts/list-bookcodes-by-lang.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +# +# List all bookcodes that match given language. +# +# Example: +# list-bookcodes-by-lang.sh en es + +if [ ! -d "$AONDIR" ]; then + >&2 echo "Please set the AONDIR environment variable" + exit +fi + +book_db="$AONDIR/common/sqlite/bookcodes.db" + +for lang in $@ +do + if [[ ! $lang =~ ^[a-z][a-z]$ ]]; then + >&2 echo "invalid language" + exit + fi + + sqlite3 -column -noheader "$book_db" <