-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopenPdfs.sh
More file actions
executable file
·56 lines (48 loc) · 1.05 KB
/
openPdfs.sh
File metadata and controls
executable file
·56 lines (48 loc) · 1.05 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/sh
#
usage() {
cat <<EOF
Pdf file opener.
openPdfs.sh [-k] [FILE]...
FILE may be:
- filenames ie filename1 filename2...
- GLOB patterns ie A*pdf B*pdf
-k keep open all files on screen. Without -k each file open and close is
sequential.
EOF
}
MUPDF=`which mupdf`
if [ ! -x "$MUPDF" ]; then
echo mupdf is not installed.
exit;
fi
if [ "$#" -eq 1 -o "$#" -eq 0 ]; then
if [ "$1" = "-k" ]; then
for file in `ls -1v *pdf`; do
if [ "$file" != "-k" ]; then
mupdf "$file"&
fi
done;
elif [ "$#" -eq 0 ]; then
FCOUNT=`ls -1 |grep pdf$ |wc -w`
if [ 0 -eq $FCOUNT ]; then
usage
exit
else
for file in `ls -1v *pdf`; do mupdf "$file"; done;
fi
else
for file in `ls -1v "$@"`; do mupdf "$file"; done;
fi
else
if [ "$1" = "-k" ]; then
for file in `ls -1v "$@"`; do
if [ "$file" != "-k" ]; then
mupdf "$file"&
fi
done;
else
for file in `ls -1v "$@"`; do mupdf "$file"; done;
fi
fi
# vim: ts=2 sw=2 et tw=78 ft=sh fdm=marker: