aboutsummaryrefslogtreecommitdiff
path: root/bash/bashrc.d
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2015-03-19 12:45:15 +1300
committerTom Ryder <tom@sanctum.geek.nz>2015-03-19 12:45:15 +1300
commit38d5b7166a291bb7b20cd772cccc29301ac78ba3 (patch)
tree6cb35061beeed948dbc026c5f6979b337752d845 /bash/bashrc.d
parentSimplify a few default value settings (diff)
downloaddotfiles-38d5b7166a291bb7b20cd772cccc29301ac78ba3.tar.gz
dotfiles-38d5b7166a291bb7b20cd772cccc29301ac78ba3.zip
Allow supplying pattern string to scr
Diffstat (limited to 'bash/bashrc.d')
-rw-r--r--bash/bashrc.d/scr.bash10
1 files changed, 8 insertions, 2 deletions
diff --git a/bash/bashrc.d/scr.bash b/bash/bashrc.d/scr.bash
index e8b6b58a..b7a49b14 100644
--- a/bash/bashrc.d/scr.bash
+++ b/bash/bashrc.d/scr.bash
@@ -1,6 +1,12 @@
# Create a temporary directory and change into it, to stop me putting stray
-# files into $HOME, and making the system do cleanup for me
+# files into $HOME, and making the system do cleanup for me. Single optional
+# argument is the string to use for naming the directory; defaults to "scr".
scr() {
- pushd -- "$(mktemp -d)"
+ if (($# <= 1)) ; then
+ pushd -- "$(mktemp -dt "${1:-scr}".XXXXX)"
+ else
+ printf 'bash: scr: too many arguments\n' >&2
+ return 1
+ fi
}