X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=blobdiff_plain;f=arxiv-rename-pdf.sh;h=1cc408a35e099cf9604ee1a3c64c8394f100c640;hb=3067965aacf2d5b62f951e2a393f420f5daba7de;hp=57b80c5213d09fd68947e50a5ea0e6fda1c07da1;hpb=12b8b183fd2530b15c4a5620ac5bd26220d99479;p=scripts.git diff --git a/arxiv-rename-pdf.sh b/arxiv-rename-pdf.sh index 57b80c5..1cc408a 100755 --- a/arxiv-rename-pdf.sh +++ b/arxiv-rename-pdf.sh @@ -29,19 +29,19 @@ tmp=$(mktemp /tmp/arxiv-bib.sh.XXXXXX) while [[ "$1" ]] do - if [[ $1 =~ ^http ]] + if [[ $1 =~ ^http ]] || [[ $1 =~ ^[0-9\.]*$ ]] then - wget "$1" - id="$(echo "$1" | sed -e 's|^.*/\([^\]*\)$|\1|')" + id="$(echo "$1" | sed -e 's|^.*/\([0-9.]*\)$|\1|')" + wget "https://arxiv.org/pdf/${id}" filename="${id}.pdf" else filename="$1" id="$(basename ${filename} .pdf)" fi - while [[ -f "$1.part" ]] # dealing with firefox's download + while [[ -f "${id}.pdf.part" ]] # dealing with firefox's download do - echo "Waiting for $1.part to vanish" + echo "Waiting for ${id}.pdf.part to vanish" sleep 1 done