You probably need the export
, so
export TMPDIR=~/tmp
Also, thinking about it, the script might start it’s own shell and the environment variable won’t persist, so you could try adding it to your .bashrc
file
echo export TMPDIR=~/tmp >> ~/.bashrc
source ~/.bashrc
Check it’s as expected when you start a new shell session
echo $TMPDIR
When you run mktemp
it should create a directory in the right location e.g. ~/tmp/tmp.aksjdfh234
Note the part in your error message:
/tmp/tmp.reaO5Z3yWc
This is what I’m intending to see change.