#!/bin/bash # gwa: convenience wrapper around `annotation-dump` - case-insensitive strings do not need to be quoted on the CLI # so one can run '$ gwa foo bar' for the equivalent of 'gwa | egrep --ignore-case "foo bar"` # Author: Gwern Branwen # Date: 2021-01-01 # When: Time-stamp: "2023-12-27 13:35:21 gwern" # License: CC-0 QUERY="$(echo $* | sed -e 's/https:\/\/gwern\.net//g')" if [ $# != 1 ]; then # paste into a single string, so we can drop the need to quote everything echo "" | annotation-dump | grep -E --ignore-case "$QUERY"; else if [ $# == 1 ]; then # unless of course it's already quoted or is a single word echo "" | annotation-dump | grep -E --ignore-case "$QUERY"; else echo "" | annotation-dump; fi fi