summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2024-05-08 06:29:52 -0300
committerEuAndreh <eu@euandre.org>2024-05-08 08:24:03 -0300
commit9e92480685484ba75db76a96c042b50b652bc07b (patch)
treeb359ffec22abdfaec67eebb4680d1717f3fc4667 /src
parentsrc/color: Add working utility (diff)
downloadeut-9e92480685484ba75db76a96c042b50b652bc07b.tar.gz
eut-9e92480685484ba75db76a96c042b50b652bc07b.tar.xz
Add 3 working utilities: tempname, mkstemp and mkdtemp
Diffstat (limited to 'src')
-rwxr-xr-xsrc/mkdtemp6
-rwxr-xr-xsrc/mkstemp7
-rwxr-xr-xsrc/tempname4
3 files changed, 17 insertions, 0 deletions
diff --git a/src/mkdtemp b/src/mkdtemp
new file mode 100755
index 0000000..646fdcd
--- /dev/null
+++ b/src/mkdtemp
@@ -0,0 +1,6 @@
+#!/bin/sh
+set -eu
+
+name="$(tempname)"
+mkdir "$name"
+printf '%s\n' "$name"
diff --git a/src/mkstemp b/src/mkstemp
new file mode 100755
index 0000000..5511dd3
--- /dev/null
+++ b/src/mkstemp
@@ -0,0 +1,7 @@
+#!/bin/sh
+set -eu
+
+
+name="$(tempname)"
+touch "$name"
+printf '%s\n' "$name"
diff --git a/src/tempname b/src/tempname
new file mode 100755
index 0000000..d3107a2
--- /dev/null
+++ b/src/tempname
@@ -0,0 +1,4 @@
+#!/bin/sh
+set -eu
+
+printf '%s\n' "${TMPDIR:-/tmp}/uuid-tmpname with spaces.$(uuid)"