summaryrefslogtreecommitdiff
path: root/shell-temp.sh
diff options
context:
space:
mode:
authorLars Wirzenius <lwirzenius@wikimedia.org>2020-05-15 13:50:58 +0300
committerLars Wirzenius <lwirzenius@wikimedia.org>2020-05-15 13:50:58 +0300
commit051426cfd7f8a66a78b02cc34da3f9e2e2372d13 (patch)
treedf99de8b38ff880ea0c32f2fd96f7a5342c810ae /shell-temp.sh
parent3af2dc7ea57e4f3956090baa8b7596687ea9b90a (diff)
downloadwmf-talks-051426cfd7f8a66a78b02cc34da3f9e2e2372d13.tar.gz
Add: talk on shell scripting
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"