Make `mktemp` flags compatible with BSD too

1. --tmpdir is GNU specific, so discontinue using it
2. Remove redundant expansion of variable inside $((...))