Use 'mktemp -t', leave tempfile cleanup to the OS

This commit is contained in:
Jean Jordaan
2017-09-28 21:54:58 +07:00
parent 1e912253ff
commit ca6a1ae2db
3 changed files with 5 additions and 6 deletions

View File

@@ -29,8 +29,7 @@ function alias_completion {
(( ${#completions[@]} == 0 )) && return 0
# create temporary file for wrapper functions and completions
rm -f "/tmp/${namespace}-*.tmp" # preliminary cleanup
local tmp_file; tmp_file="$(mktemp "/tmp/${namespace}-${RANDOM}XXX.tmp")" || return 1
local tmp_file; tmp_file="$(mktemp -t "${namespace}-${RANDOM}XXX.tmp")" || return 1
local completion_loader; completion_loader="$(complete -p -D 2>/dev/null | sed -Ene 's/.* -F ([^ ]*).*/\1/p')"