From da3ac08b52ada16365583edd11e412aa64627266 Mon Sep 17 00:00:00 2001 From: qbi Date: Sun, 13 Jun 2021 15:21:15 +0200 Subject: [PATCH] Quoting korrigiert und `exit 1` ersetzt --- rechnung.sh | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/rechnung.sh b/rechnung.sh index ceae052..ccf84c1 100755 --- a/rechnung.sh +++ b/rechnung.sh @@ -52,8 +52,7 @@ INSTALL_LCO_FILE=0 ANZAHL_RECHNUNGEN=0 READABLES_TO_CHECK= -STARTDIR="$(realpath -s $(pwd) -)" +STARTDIR="$(realpath -s "$(pwd)")" TEMPDIR= OUTPUTDIR="$STARTDIR" LINE_BUFFER= @@ -223,14 +222,14 @@ print_version() { usage_and_exit() { print_usage - exit $1 + exit 1 } clear_and_exit() { - if [ ! $(pwd) = "$STARTDIR" ]; then + if [ ! "$(pwd)" = "$STARTDIR" ]; then print_info "Wechsle nach '$STARTDIR' zurück" - cd $STARTDIR + cd "$STARTDIR" fi if [ -d "$TEMPDIR" ]; then print_info "Entferne temporäres Verzeichnis '$TEMPDIR'" @@ -242,7 +241,7 @@ clear_and_exit() { else echo "[*] $msg" fi - exit $1 + exit 1 } # Diverse Checks @@ -264,7 +263,7 @@ check_binary() { exit 3 else if [ -h "$program" ]; then - program=$(realpath $program) + program=$(realpath "$program") print_middle " zeigt auf $program ..." if ! which "$program" 2>&1 >/dev/null; then print_failed "$program ist nicht im Pfad" @@ -414,7 +413,7 @@ install_sty() ( ## notwendige programm prüfen for program in "$GIT_BIN" "$LATEX_BIN"; do - check_binary $program + check_binary "$program" done ## Repo clonen print_start "Hole Repo von $RECHNUNG_STY_URL ..." @@ -540,7 +539,7 @@ make_invoice() { rechnungsnummer="$inv_date--$LFDNR" subject="Rechnung zu $SHORT" filename="$(date '+%Y%m%d')_Rechnung_${month_ascii}_$(echo "$KUNDE" | $TR_BIN " " "_").ltx" - sedfile="$(basename -s .ltx $filename).sed" + sedfile="$(basename -s .ltx "$filename").sed" buffer="$KUNDE; $ADRESSE" anschrift="$(echo "$buffer" | sed 's/; /\\\\\\\\\\\\\\ /g')" @@ -555,7 +554,7 @@ make_invoice() { printf "s!#POSITION#!%s!\n" "$POSITION" printf "s!#BETRAG#!%s!\n" "$BETRAG" printf "s!#DEADLINE#!%s!\n" "$inv_dead" - } >$sedfile + } > "$sedfile" cp "$TEMPLATEFILE" "$filename" $SED_BIN -i -f "$sedfile" "$filename" if [ "$DEBUG" -eq 1 ]; then @@ -565,7 +564,7 @@ make_invoice() { if ! $GENPDF "$filename" 1>&2 >/dev/null; then print_error "Kompilierung von $filename fehlgeschlagen" logfile=$(echo "$OUTPUTDIR/$filename" | sed -e s/ltx/log/) - print_error "$(grep "Error" $logfile)" + print_error "$(grep "Error" "$logfile")" else print_info "Rechnung $filename erfolgreich erstellt" ANZAHL_RECHNUNGEN=$(expr $ANZAHL_RECHNUNGEN + 1) @@ -670,7 +669,7 @@ print_head ## Die nötigen Programme und rechnung.sty testen for program in $EXECUTABLES_TO_CHECK; do - check_binary $program + check_binary "$program" done ## relative pfade in den variablen LCOFILE, KUNDENFILE und TEMPLATEFILE wenn