Skip to content

Commit 89f69bb

Browse files
author
Your Name
committed
oeis: awk toupper(), case insensitive language search
1 parent 73a9a53 commit 89f69bb

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

share/adapters/oeis.sh

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,7 @@ oeis() (
112112
> ${TMP}/prog
113113
# Print out code sample for specified language
114114
rm -f ${TMP}/code_snippet
115-
awk -v tgt="${LANGUAGE^^}" -F'[()]' '/^\(/{f=(tgt==$2)} f' ${TMP}/prog > ${TMP}/code_snippet
116-
L="${LANGUAGE:0:1}"
117-
LANGUAGE="${LANGUAGE:1}"
118-
LANGUAGE="${L^^}${LANGUAGE,,}"
119-
[ $(wc -c < $TMP/code_snippet) -eq 0 ] && awk -v tgt="${LANGUAGE}" -F'[()]' '/^\(/{f=(tgt==$2)} f' ${TMP}/prog > ${TMP}/code_snippet
115+
awk -v tgt="${LANGUAGE^^}" -F'[()]' '/^\(/{f=(tgt==toupper($2))} f' ${TMP}/prog > ${TMP}/code_snippet
120116
fi
121117
# Print code snippet with 4-space indent to enable colorization
122118
if [ $(wc -c < $TMP/code_snippet) -ne 0 ]

0 commit comments

Comments
 (0)