From 0459598c9b7568cf1304d938585fe3dda5d84c3d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fran=C3=A7ois=20Fleuret?= Date: Mon, 21 Nov 2022 08:21:54 +0100 Subject: [PATCH] Update. --- arxiv.sh | 12 +++++++----- kill-unused-xterms.sh | 5 ++++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/arxiv.sh b/arxiv.sh index 1cc408a..556b403 100755 --- a/arxiv.sh +++ b/arxiv.sh @@ -29,10 +29,11 @@ tmp=$(mktemp /tmp/arxiv-bib.sh.XXXXXX) while [[ "$1" ]] do - if [[ $1 =~ ^http ]] || [[ $1 =~ ^[0-9\.]*$ ]] + if [[ $1 =~ ^http ]] || [[ $1 =~ ^[0-9v\.]*$ ]] then - id="$(echo "$1" | sed -e 's|^.*/\([0-9.]*\)$|\1|')" - wget "https://arxiv.org/pdf/${id}" + id="$(echo "$1" | sed -e 's|^.*/\([0-9v.]*\)$|\1|' | sed -e 's/v[0-9]*$//')" + wget -U "Mozilla/5.0 (iPhone; CPU iPhone OS 11_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1" "https://arxiv.org/pdf/${id}" + mv "${id}" "${id}.pdf" filename="${id}.pdf" else filename="$1" @@ -112,7 +113,8 @@ EOF AUTHORS="${FIRST_AUTHOR} et al" fi - TITLE="$(echo "${AUTHORS} - ${TITLE} ${YEAR} ${id}.pdf" | sed -e 's/ /_/g')" + #TITLE="$(echo "${AUTHORS} - ${TITLE} ${YEAR} ${id}.pdf" | sed -e 's/ /_/g')" + TITLE="$(echo "${AUTHORS} - ${TITLE} ${YEAR} ${id}.pdf" | sed -e 's/[^-a-zA-Z0-9_\.\/]/_/g' | sed -e 's/__*/_/g')" mv -v "${filename}" "${ARXIV_BIBDIR}/${TITLE}" @@ -122,4 +124,4 @@ EOF done -rm -rf ${tmp} +#rm -rf ${tmp} diff --git a/kill-unused-xterms.sh b/kill-unused-xterms.sh index 075b2ba..8100b6b 100755 --- a/kill-unused-xterms.sh +++ b/kill-unused-xterms.sh @@ -21,12 +21,15 @@ set -e +TERMINAL_APP=xterm +[[ "${TERMINAL_APP}" ]] || TERMINAL_APP=xterm + NB_KILLED=0 NB_TOTAL=0 SHELL_NAME=$(basename ${SHELL}) # Loop through the pid of xterms -for ppid in $(ps h -C xterm -o pid); do +for ppid in $(ps h -C "${TERMINAL_APP}" -o pid); do N=0 -- 2.39.5