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"
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}"
done
-rm -rf ${tmp}
+#rm -rf ${tmp}
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