-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathbibtex2pdf
More file actions
executable file
·34 lines (27 loc) · 834 Bytes
/
Copy pathbibtex2pdf
File metadata and controls
executable file
·34 lines (27 loc) · 834 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
#
# Authors: Gerd Wachsmuth <gerd.wachsmuth@mathematik.tu-chemnitz.de>
# Version: 0.1
# Licence: GPL v3, see http://www.gnu.org/licenses/gpl.html
if [ "x$1" = "x--help" ]; then
# display help message
echo "this script reads bib entries from stdin and "
echo "Example:"
echo " cat Teaching.bib | tail -n 11 | bibtex2pdf"
exit 1
fi
# Name for temporary files
# Remove existing temporary files
rm -f /tmp/my_tmp_file{1,2}
# Pipe stdin into both bibtex2{doi,filename}
tee >( bibtex2doi > /tmp/my_tmp_file1 ) | bibtex2filename > /tmp/my_tmp_file2
# Read the temporary files line by line and invoke doi2pdf
exec 6<"/tmp/my_tmp_file2"
while read -r line
do
read -r f2line <&6
doi2pdf "${line}" "${f2line}"
done <"/tmp/my_tmp_file1"
exec 6<&-
# Remove temporary files
rm -f /tmp/my_tmp_file{1,2}