From 89f69bbd405f6fcee07b9e604d2e9fa378e4cb25 Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 19 Jun 2020 08:00:20 -0400 Subject: [PATCH] oeis: awk toupper(), case insensitive language search --- share/adapters/oeis.sh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/share/adapters/oeis.sh b/share/adapters/oeis.sh index cedc419..7d99690 100755 --- a/share/adapters/oeis.sh +++ b/share/adapters/oeis.sh @@ -112,11 +112,7 @@ oeis() ( > ${TMP}/prog # Print out code sample for specified language rm -f ${TMP}/code_snippet - awk -v tgt="${LANGUAGE^^}" -F'[()]' '/^\(/{f=(tgt==$2)} f' ${TMP}/prog > ${TMP}/code_snippet - L="${LANGUAGE:0:1}" - LANGUAGE="${LANGUAGE:1}" - LANGUAGE="${L^^}${LANGUAGE,,}" - [ $(wc -c < $TMP/code_snippet) -eq 0 ] && awk -v tgt="${LANGUAGE}" -F'[()]' '/^\(/{f=(tgt==$2)} f' ${TMP}/prog > ${TMP}/code_snippet + awk -v tgt="${LANGUAGE^^}" -F'[()]' '/^\(/{f=(tgt==toupper($2))} f' ${TMP}/prog > ${TMP}/code_snippet fi # Print code snippet with 4-space indent to enable colorization if [ $(wc -c < $TMP/code_snippet) -ne 0 ]