Skip to content

Commit 50332b3

Browse files
committed
Scripts/latex: Fix shellcheck warnings
Shellcheck[1] gives below warnings for `latex.sh` as below. Those are not real problems for now, but fixing those would be helpful for future update. This commit therefore fixes those except the shebang position, as the warning is for Shellcheck itself. [1] https://www.shellcheck.net/ $ shellcheck latex.sh In latex.sh line 1: # latex.sh ^-- SC2148: Tips depend on target shell and yours is unknown. Add a shebang. In latex.sh line 8: for D in $(ls ../); do ^-- SC2045: Iterating over ls output is fragile. Use globs. In latex.sh line 12: pandoc ../$D/README.md ../$D/linux-*.md -o build/$D.tex --template default ^-- SC2086: Double quote to prevent globbing and word splitting. ^-- SC2086: Double quote to prevent globbing and word splitting. ^-- SC2086: Double quote to prevent globbing and word splitting. In latex.sh line 16: cd ./build ^-- SC2164: Use 'cd ... || exit' or 'cd ... || return' in case cd fails. In latex.sh line 19: pdflatex -interaction=nonstopmode $f ^-- SC2086: Double quote to prevent globbing and word splitting. In latex.sh line 22: cd ../ ^-- SC2164: Use 'cd ... || exit' or 'cd ... || return' in case cd fails. Signed-off-by: SeongJae Park <[email protected]>
1 parent 1e3bbbe commit 50332b3

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

Scripts/latex.sh

+9-7
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,23 @@
55
#!/bin/bash
66
rm -r build
77
mkdir build
8-
for D in $(ls ../); do
9-
if [ -d "../${D}" ]
8+
for D in ../*; do
9+
if [ -d "$D" ]
1010
then
11-
echo "Converting $D . . ."
12-
pandoc ../$D/README.md ../$D/linux-*.md -o build/$D.tex --template default
11+
name=$(basename "$D")
12+
echo "Converting $name . . ."
13+
pandoc "$D"/README.md "$D"/linux-*.md \
14+
-o build/"$name".tex --template default
1315
fi
1416
done
1517

16-
cd ./build
18+
cd ./build || exit 1
1719
for f in *.tex
1820
do
19-
pdflatex -interaction=nonstopmode $f
21+
pdflatex -interaction=nonstopmode "$f"
2022
done
2123

22-
cd ../
24+
cd ../ || exit 1
2325
pandoc ../README.md ../SUMMARY.md ../CONTRIBUTING.md ../contributors.md \
2426
-o ./build/Preface.tex --template default
2527

0 commit comments

Comments
 (0)