From f46e1af0a94c1c407621ddf86e711c2dcc31b847 Mon Sep 17 00:00:00 2001 From: Yargo iMac Date: Thu, 31 Aug 2017 15:20:14 +0200 Subject: [PATCH] add use of TMPDIR for temporary dir, if defined --- README.md | 2 +- wrapdc.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 8b4b466..ce72a73 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ This wrapper renders `dc` more usable as a command line calculator by: - defining commonly used macros for more complex operations - saving precision, top of stack, and registers 0 to 9 ("memories") from one invocation to the next in the status file `$HOME/.wdcrc` -- saving last top of stack value in `/tmp/wdc-$USER` for further direct use +- saving last top of stack value in `${TMPDIR:-/tmp}/wdc-$USER` for further direct use (change file name in the source, if desired) # PREREQUISITES diff --git a/wrapdc.sh b/wrapdc.sh index 8b4ec19..b6db4a7 100755 --- a/wrapdc.sh +++ b/wrapdc.sh @@ -1,10 +1,10 @@ #!/bin/sh # wrapper for dc -info="wrapper for dc // 2017-03-10 Y.Bonetti // see https://gitlab.com/yargo/wrapdc" +info="wrapper for dc // 2017-08-31 Y.Bonetti // see https://gitlab.com/yargo/wrapdc" # global status file statf=$HOME/.wdcrc # output file (last stack top) -outf=/tmp/wdc-$USER +outf=${TMPDIR:-/tmp}/wdc-$USER # clear state: precision 2, clear stack and reg.0..9 clstat='2k 0 0 0 0 0 0s00s10s20s30s40s50s60s70s80s9' if test ! -r $statf