From 835a273f0a708b5ef8c59e299b034c78b045d936 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Wed, 10 Aug 2016 13:31:03 +1200 Subject: Port easy bashrc.d scripts to pdkshrc.d Have left out anything that requires non-trivial fixes, mostly due to variable scope or missing features. --- pdksh/pdkshrc.d/scr.pdksh | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 pdksh/pdkshrc.d/scr.pdksh (limited to 'pdksh/pdkshrc.d/scr.pdksh') 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 +} -- cgit v1.2.3