Apply defaults the oathtool command when get-ing codes

This commit is contained in:
Amarpreet Minhas 2022-10-22 17:28:20 -04:00
parent b3a9d1010b
commit 38aa163634

2
otpish
View file

@ -72,7 +72,7 @@ if [ "${COMMAND}" = "get" ]; then
if [ "$(echo ${i} | cut -d'=' -f1)" = "digits" ]; then digits=$(echo ${i} | cut -d'=' -f2); fi if [ "$(echo ${i} | cut -d'=' -f1)" = "digits" ]; then digits=$(echo ${i} | cut -d'=' -f2); fi
if [ "$(echo ${i} | cut -d'=' -f1)" = "period" ]; then period=$(echo ${i} | cut -d'=' -f2); fi if [ "$(echo ${i} | cut -d'=' -f1)" = "period" ]; then period=$(echo ${i} | cut -d'=' -f2); fi
done done
oathtool --totp -b -s "${period}s" -d ${digits} ${secret} oathtool --totp -b -s "${period:-30}s" -d ${digits:-6} ${secret}
exit exit
fi fi