Polished scripts

This commit is contained in:
Sun Knudsen 2021-03-06 14:39:16 -05:00
parent 09667692cd
commit 4ff43c6f2b
No known key found for this signature in database
GPG key ID: 1FA767862BBD1305
6 changed files with 19 additions and 16 deletions

View file

@ -11,8 +11,8 @@ while [[ $# -gt 0 ]]; do
"Usage: qr-restore.sh [options]" \
"" \
"Options:" \
" --word-list split secret into word list" \
" -h, --help display help for command"
" --word-list split secret into word list" \
" -h, --help display help for command"
exit 0
;;
--word-list)
@ -68,9 +68,13 @@ if [ "$answer" = "y" ]; then
if [ "$word_list" = true ]; then
printf "%s" "Secret: "
array=($secret)
for i in ${!array[@]}; do
position=$(($i + 1))
printf "%d. $bold%s$normal " "$position" "${array[$i]}"
last_index=$(echo "${#array[@]} - 1" | bc)
for index in ${!array[@]}; do
position=$(($index + 1))
printf "%d. $bold%s$normal" "$position" "${array[$index]}"
if [ $index -lt $last_index ]; then
printf " "
fi
done
printf "\n"
else