File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change 99# oeis <val_a, val_b, val_c, ...>
1010oeis () (
1111 local URL=' https://oeis.org/search?q='
12- local TMP=/tmp/oeis
13- local DOC=/tmp/oeis /doc.html
12+ local TMP=/tmp/oeis_ ${RANDOM}
13+ local DOC=${TMP} /doc.html
1414 local MAX_TERMS_LONG=30
1515 local MAX_TERMS_SHORT=10
1616 mkdir -p $TMP
@@ -53,6 +53,7 @@ oeis() (
5353 [[ -f $TMP /section && $( wc -c < $TMP /section) -ne 0 ]] \
5454 && cat ${TMP} /section | sort -u \
5555 || printf ' No code snippets available.\n'
56+ rm -rf $TMP
5657 return 0
5758 fi
5859 # Print ID
@@ -109,8 +110,7 @@ oeis() (
109110 let i++
110111 done <${TMP}/authors
111112 # Print snippet
112- cat ${TMP}/code_snippet \
113- | sed ' s/^/ /'
113+ sed ' s/^/ /' ${TMP}/code_snippet
114114 else
115115 printf "${SECTION^^} unavailable. Use :list to view available languages.\n"
116116 fi
@@ -164,6 +164,7 @@ curl cheat.sh/oeis/A2/python
164164# List all available implementations of the A2 OEIS sequence
165165curl cheat.sh/oeis/A2/:list
166166"
167+ rm -rf $TMP
167168 return 1
168169 fi
169170 # Error statements
@@ -178,6 +179,8 @@ curl cheat.sh/oeis/A2/:list
178179 | sed 's/,//' \
179180 | rev \
180181 | sed 's/&.*/]/'
182+ rm -rf $TMP
183+ return 0
181184)
182185
183186oeis $@
You can’t perform that action at this time.
0 commit comments