Faster max_page calculation
1 files changed, 1 insertions(+), 1 deletions(-) M main.sh
M main.sh => main.sh +1 -1
@@ 12,7 12,7 @@ else echo "Failed!" exit 1 fi MAX_PAGE=$(elinks -dump ${POST_ID}.1.rp | fgrep per_page | cut -d . -f 2 | sort -u | fgrep file | cut -d = -f 2 | cut -d \& -f 1 | sort -n | tail -n 1) MAX_PAGE=$(fgrep last_page ${POST_ID}.1.rp | perl -pe 's/.+(\d+)\S+;per_page=\d+\S+Last.*/\1/; print; exit') if (( MAX_PAGE \> 1 )); then seq 2 ${MAX_PAGE} > ${POST_ID}.index echo "Done!"