summaryrefslogtreecommitdiff
blob: f759bae7f05a34594c5a5d38664e6a8ef6bf6c45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
--- src/chklref.in
+++ src/chklref.in
@@ -64,18 +64,16 @@
 basetexfile=${1##*/}
 basetexfile=${basetexfile%.tex}
 dirtexfile=${1%/*}
-if [ ${dirtexfile} == $1 ]; then dirtexfile="."; fi
+if [ "${dirtexfile}" = "$1" ]; then dirtexfile="."; fi
 
-cwd=${PWD}
-cd ${dirtexfile}
+cd -- "${dirtexfile}"
 
 printf "Running $latex_cmd on $basetexfile.tex to collect labels,
 references and environment declarations\n\n"
 $latex_cmd --interaction errorstopmode "${basetexfile}" > "$out" 2>&1
 rm -f -- "$basetexfile".tex.chk
 $latex_cmd --interaction errorstopmode --jobname "$basetexfile" \
-    '\RequirePackage{chklref}\input' "{$basetexfile.tex}" &> $out
+    '\RequirePackage{chklref}\input' "{$basetexfile.tex}" > "$out" 2>&1
 $PERL "$SCRIPTSDIR"/chkparser "$basetexfile".tex.chk
 [ $debug -ne 0 ] || rm -f -- "$basetexfile".tex.chk
 
-cd ${cwd}