aboutsummaryrefslogtreecommitdiff
path: root/pdksh/pdkshrc.d/scr.pdksh
diff options
context:
space:
mode:
Diffstat (limited to 'pdksh/pdkshrc.d/scr.pdksh')
-rw-r--r--pdksh/pdkshrc.d/scr.pdksh11
1 files changed, 11 insertions, 0 deletions
diff --git a/pdksh/pdkshrc.d/scr.pdksh b/pdksh/pdkshrc.d/scr.pdksh
new file mode 100644
index 00000000..01bd20cb
--- /dev/null
+++ b/pdksh/pdkshrc.d/scr.pdksh
@@ -0,0 +1,11 @@
+# Create a temporary directory and change into it, to stop me putting stray
+# 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() {
+ if (($# <= 1)) ; then
+ cd -- "$(mktd "${1:-scr}")"
+ else
+ printf 'ksh: scr: too many arguments\n' >&2
+ return 2
+ fi
+}