I'm trying to write a bash script that will let me save a backup code (lots of numbers) in a file. I've finished the script but it's only letting me to save 4096 digits of the code.
I tried to do this:
# Ask for backup code
read -p "Backup code:" backupcode
# Check backup code length
l="${#backupcode}"
m=4096
if (( l > m )); then
echo -e "${RED}ERROR:${NC} Backup is too large! The limit is 4096 digits."
else
# Save backup code in the file
echo $backupcode > "${path[$i]}"
fi
I think this didn't detect that the backup was too large. So, I think there's something with read command.
If there's a limit in read, are there any alternatives I can use?