Instead of explicitly specifying a /tmp/ path to mktemp, use the -t flag, which respects TMPDIR.