Skip to content

Commit

Permalink
Run shellcheck and fix some shell issues
Browse files Browse the repository at this point in the history
  • Loading branch information
utensil committed Oct 9, 2024
1 parent 3b659bd commit 04ed19d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
12 changes: 6 additions & 6 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -126,17 +126,17 @@ function build {
}

function lize {
./lize.sh spin-0001 2>&1 > /dev/null
./lize.sh spin-0001 > /dev/null 2>&1
show_lize_result spin-0001
./lize.sh hopf-0001 2>&1 > /dev/null
./lize.sh hopf-0001 > /dev/null 2>&1
show_lize_result hopf-0001
./lize.sh ca-0001 2>&1 > /dev/null
./lize.sh ca-0001 > /dev/null 2>&1
show_lize_result ca-0001
./lize.sh tt-0001 2>&1 > /dev/null
./lize.sh tt-0001 > /dev/null 2>&1
show_lize_result tt-0001
./lize.sh uts-000C 2>&1 > /dev/null
./lize.sh uts-000C > /dev/null 2>&1
show_lize_result uts-000C
# ./lize.sh uts-0001 2>&1 > /dev/null
# ./lize.sh uts-0001 > /dev/null 2>&1
# show_lize_result uts-0001
}

Expand Down
6 changes: 6 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,11 @@ envs:
#!/usr/bin/env bash
echo "PROJECT_ROOT: $PROJECT_ROOT"
install-shellcheck:
brew install shellcheck

run-shellcheck:
shellcheck *.sh

# act:
# ./act.sh
14 changes: 7 additions & 7 deletions lize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ TEX_FILE="$1.tex"
AUX_FILE="$1.aux"
PDF_FILE="$1.pdf"

rm build/$1.* 2>&1 >/dev/null || echo no files to clean
rm build/$1.* >/dev/null 2>&1 || echo no files to clean

cp output/$XML_FILE build/$XML_FILE

Expand All @@ -35,16 +35,16 @@ UNICOCE_LATEX=lualatex
# if environment variable TEC is not set
if [ -z "$TEC" ]; then
echo "lize.sh| using $UNICOCE_LATEX"
$UNICOCE_LATEX -halt-on-error -interaction=nonstopmode --shell-escape $TEX_FILE 2>&1 >/dev/null
$UNICOCE_LATEX -halt-on-error -interaction=nonstopmode --shell-escape $TEX_FILE >/dev/null 2>&1
# https://tex.stackexchange.com/a/295524/75671
# biber $TEX_FILE
# We should ignore bibtex errors if it's simply an empty .bib file
bibtex $AUX_FILE 2>&1 >/dev/null || echo "lize.sh| Ignoring bibtex error"
$UNICOCE_LATEX -halt-on-error -interaction=nonstopmode --shell-escape $TEX_FILE 2>&1 >/dev/null
$UNICOCE_LATEX -halt-on-error -interaction=nonstopmode --shell-escape $TEX_FILE 2>&1 >/dev/null
bibtex $AUX_FILE >/dev/null 2>&1 || echo "lize.sh| Ignoring bibtex error"
$UNICOCE_LATEX -halt-on-error -interaction=nonstopmode --shell-escape $TEX_FILE >/dev/null 2>&1
$UNICOCE_LATEX -halt-on-error -interaction=nonstopmode --shell-escape $TEX_FILE >/dev/null 2>&1
else
echo "lize.sh| using tectonic"
tectonic -Z shell-escape-cwd=`pwd` --keep-intermediates --keep-logs --outdir `pwd` $TEX_FILE 2>&1 >/dev/null
tectonic -Z shell-escape-cwd=`pwd` --keep-intermediates --keep-logs --outdir `pwd` $TEX_FILEi >/dev/null 2>&1
fi

cd ..
Expand All @@ -55,4 +55,4 @@ echo "lize.sh| Open build/$1.log to see the log."
echo "lize.sh| Open build/$TEX_FILE to see the LaTeX source."
echo "lize.sh| Open output/$PDF_FILE to see the result."

# use ./lize.sh uts-0001 2>&1|grep lize to see a short output
# use ./lize.sh uts-0001 2>&1|grep lize to see a short output

0 comments on commit 04ed19d

Please sign in to comment.