From 5db62e550f516aaa8b1365545d9a871afab3b8c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Sun, 25 Apr 2021 11:52:59 +0300 Subject: [PATCH] smaller extract-and-generatm --- IV/extract-and-generate | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/IV/extract-and-generate b/IV/extract-and-generate index 03cabff..30df5dc 100755 --- a/IV/extract-and-generate +++ b/IV/extract-and-generate @@ -1,14 +1,11 @@ -#!/bin/bash -set -euo pipefail +#!/bin/bash -eu s=${1:-mj-msc-full.pdf} d=$(mktemp -d) - -readonly f=mj-msc.pdf -readonly l="$d/make.log" +f=mj-msc.pdf +l="$d/make.log" echo "Extracting $s to workdir $d/"; pdfdetach -saveall -o "$d" "$s" echo "Logs in $l ..."; make -j "$(nproc)" -C "$d" "$f" &> "$l" || { - echo "Failed to generate. $l extract:" && tail -20 "$l" - exit 1 + echo "Failed to generate. $l extract:"; tail -20 "$l"; exit 1 } echo "Opening $d/$f ..."; xdg-open "$d/$f" echo "$d/$f was closed. Removing $d"; rm -fr "$d"