aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xwebsvgtex36
1 files changed, 10 insertions, 26 deletions
diff --git a/websvgtex b/websvgtex
index 76ab139..df4e604 100755
--- a/websvgtex
+++ b/websvgtex
@@ -1,29 +1,13 @@
#!/bin/sh
-err() {
- { set +x; } 2>/dev/null
- echo "$@" >&2
- exit 1
-}
-
-ensure_noset() {
- [ $# -lt 1 ] && return 0
- $@ || err failed executing: "$@"
-}
-
-ensure() {
- { set +x; } 2>/dev/null
- [ $# -lt 1 ] && return 0
- $@ || err failed executing: "$@"
- { set -x; } 2>/dev/null
-}
+set -eux
rxrand="$(base64 < /dev/random | tr -d '/+=' | head -c 10)"
opwd="$(pwd)"
-ensure_noset mkdir /tmp/websvgtex-$rxrand
-ensure_noset cd /tmp/websvgtex-$rxrand
+mkdir /tmp/websvgtex-$rxrand
+cd /tmp/websvgtex-$rxrand
cat >m.tex <<EOF
\documentclass[preview]{standalone}
@@ -37,18 +21,18 @@ cat >>m.tex <<EOF
\end{document}
EOF
+{ set +u; } 2>/dev/null
if [ -z "$1" ]
then
export_filename="m.svg"
else
export_filename="$1"
fi
+{ set -u; } 2>/dev/null
-{ set -x; } 2>/dev/null
+latex m.tex
+latex m.tex
+dvips m.dvi
+inkscape m.ps --export-plain-svg --export-filename="$export_filename"
-ensure latex m.tex
-ensure latex m.tex
-ensure dvips m.dvi
-ensure inkscape m.ps --export-plain-svg --export-filename="$export_filename"
-
-ensure mv "$export_filename" "$opwd"
+mv "$export_filename" "$opwd"