1
1
mirror of https://github.com/chubin/cheat.sh.git synced 2024-12-03 03:24:22 +03:00

Fixed 2 arg input bugs

This commit is contained in:
Your Name 2020-06-11 07:22:41 -04:00
parent ca9d5bc177
commit 5c27a3bdb5

View File

@ -52,15 +52,15 @@ oeis() (
# . oeis <SEQ_ID> <LANGUAGE>
# . oeis <LANGUAGE> <SEQ_ID>
isNum='^[0-9]+$'
if [ $# -lt 3 ] && [[ ${1:1} =~ $isNum || ${2:1} =~ $isNum || ${1} =~ $isNum || ${2} =~ $isNum ]] && [[ ! ${1} =~ $isNum || ! ${2} =~ $isNum ]]
if [ $# -lt 3 ] && [[ ${1:1} =~ $isNum || ${2:1} =~ $isNum || ${1} =~ $isNum || ${2} =~ $isNum ]] && ! echo $1 | grep -q '[0-9]' || ! echo $2 | grep -q '[0-9]'
then
# Arg-Parse ID, Generate URL
if echo ${1^^} | grep -q '[B-Z]'
then
ID=$2
ID=${2^^}
LANGUAGE=$1
else
ID=$1
ID=${1^^}
LANGUAGE=$2
fi
[[ ${ID:0:1} == 'A' ]] && ID=${ID:1}