aboutsummaryrefslogtreecommitdiff
path: root/aux/lib.sh
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xaux/lib.sh15
1 files changed, 6 insertions, 9 deletions
diff --git a/aux/lib.sh b/aux/lib.sh
index d64409a..52f1315 100755
--- a/aux/lib.sh
+++ b/aux/lib.sh
@@ -5,26 +5,23 @@
#
uuid() {
- # Taken from:
- # https://serverfault.com/a/799198
od -xN20 /dev/urandom |
- head -1 |
+ head -n1 |
awk '{OFS="-"; print $2$3,$4,$5,$6,$7$8$9}'
}
tmpname() {
- echo 'mkstemp(template)' | m4 -D template="${TMPDIR:-/tmp}/m4-tmpname."
+ printf '%s/uuid-tmpname with spaces.%s' "${TMPDIR:-/tmp}" "$(uuid)"
}
mkstemp() {
name="$(tmpname)"
- touch "$name"
- echo "$name"
+ touch -- "$name"
+ printf '%s' "$name"
}
mkdtemp() {
name="$(tmpname)"
- rm -f "$name"
- mkdir "$name"
- echo "$name"
+ mkdir -- "$name"
+ printf '%s' "$name"
}