aboutsummaryrefslogtreecommitdiff
path: root/bin/mktd.sh
blob: 61c1b5ab9649fb0005e3a0d28f094c88256fee52 (plain) (blame)
1
2
3
4
5
6
7
8
9
# Try to make a random temp directory

# Build the intended directory name, with the last element a random integer
# from 1..2^31
lim=$((2 << 31))
dn=${TMPDIR:-/tmp}/${1:-mktd}.$$.$(rndi 1 "$e")

# Create the directory and print its name if successful
mkdir -m 700 -- "$dn" && printf '%s\n' "$dn"