diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2016-08-04 23:50:08 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2016-08-04 23:50:08 +1200 |
commit | e503ad920b06e8ae983b2090c973102f2e2dc760 (patch) | |
tree | fdb29124005715098d0a3a4a54b4a7cc199e5544 /bash/bashrc.d | |
parent | Add missing code to tmpfile cleanup hooks (diff) | |
download | dotfiles-e503ad920b06e8ae983b2090c973102f2e2dc760.tar.gz dotfiles-e503ad920b06e8ae983b2090c973102f2e2dc760.zip |
Switch fnl()/scr() to use mktd(1)
Diffstat (limited to 'bash/bashrc.d')
-rw-r--r-- | bash/bashrc.d/fnl.bash | 7 | ||||
-rw-r--r-- | bash/bashrc.d/scr.bash | 2 |
2 files changed, 3 insertions, 6 deletions
diff --git a/bash/bashrc.d/fnl.bash b/bash/bashrc.d/fnl.bash index b63d64b1..1f543dbf 100644 --- a/bash/bashrc.d/fnl.bash +++ b/bash/bashrc.d/fnl.bash @@ -23,11 +23,8 @@ fnl() { fi # Create a temporary directory or bail - local dirname template - template=$FUNCNAME.$1.XXXXXX - if ! dirname=$(mktemp -dt -- "$template") ; then - return - fi + local dirname + dirname=$(mktd "$FUNCNAME") || return # Run the command and save its exit status local ret diff --git a/bash/bashrc.d/scr.bash b/bash/bashrc.d/scr.bash index 046b8691..bf2990fd 100644 --- a/bash/bashrc.d/scr.bash +++ b/bash/bashrc.d/scr.bash @@ -3,7 +3,7 @@ # argument is the string to use for naming the directory; defaults to "scr". scr() { if (($# <= 1)) ; then - pushd -- "$(mktemp -dt -- "${1:-scr}".XXXXX)" + pushd -- "$(mktd "${1:-"$FUNCNAME"}")" else printf 'bash: %s: too many arguments\n' \ "$FUNCNAME" >&2 |