add use of TMPDIR for temporary dir, if defined

This commit is contained in:
Yargo iMac 2017-08-31 15:20:14 +02:00
parent 044085f70e
commit f46e1af0a9
2 changed files with 3 additions and 3 deletions

View File

@ -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

View File

@ -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