From e503ad920b06e8ae983b2090c973102f2e2dc760 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 4 Aug 2016 23:50:08 +1200 Subject: Switch fnl()/scr() to use mktd(1) --- bash/bashrc.d/fnl.bash | 7 ++----- bash/bashrc.d/scr.bash | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) (limited to 'bash/bashrc.d') 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 -- cgit v1.2.3