summaryrefslogtreecommitdiff
path: root/shell-temp.sh
diff options
context:
space:
mode:
Diffstat (limited to 'shell-temp.sh')
-rw-r--r--shell-temp.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/shell-temp.sh b/shell-temp.sh
new file mode 100644
index 0000000..7fd1d52
--- /dev/null
+++ b/shell-temp.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+set -eu
+
+cleanup() {
+ rm -rf "$tempdir"
+}
+
+
+tempdir="$(mktemp -d)"
+trap cleanup EXIT
+
+
+echo foo > "$tempdir/foo.txt"
+echo "$tempdir"