Fixed regex bug that would prevent more than ten lines from being read

This commit is contained in:
Anon 2024-03-10 14:43:10 -07:00
parent b6270492cb
commit b225ac8506

View File

@ -36,7 +36,7 @@ INDEX=1
NLINES="$(wc -l "$MASTER_FILE" | cut -d ' ' -f1)" NLINES="$(wc -l "$MASTER_FILE" | cut -d ' ' -f1)"
if [ -s "$LOG_FILE" ];then if [ -s "$LOG_FILE" ];then
INDEX="$(grep ".*Index: [0-9]*$" "$LOG_FILE" | tail -n 1 | grep -o "[0-9]$")" INDEX="$(grep ".*Index: [0-9]*$" "$LOG_FILE" | tail -n 1 | grep -o "[0-9]*$")"
INDEX="$(expr "$INDEX" '%' "$NLINES" '+' '1')" INDEX="$(expr "$INDEX" '%' "$NLINES" '+' '1')"
fi fi
PICKED="$(sed "${INDEX}q;d" "$MASTER_FILE")" PICKED="$(sed "${INDEX}q;d" "$MASTER_FILE")"