Closed erkie closed 9 years ago
TMP_DIR
is path to a fresh temporary directory created with mktemp -d
and is never changed. I wanted to avoid conflicts with files in current directory. But yes, I agree with you, on the first sight it doesn't look good.
So I tried mktemp -d
on Mac OS X, and it only prints:
usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
mktemp [-d] [-q] [-u] -t prefix
So I'm not sure if the following will break the script prematurely but this is what might happen if it runs on Mac:
$ TMP_DIR=$(mktemp -d)
usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
mktemp [-d] [-q] [-u] -t prefix
$ echo "rm -rf $TMP_DIR"
rm -rf
I'm terribly sorry if this is totally wrong. :) And again, I wish I could come with some more constructive ideas!
What if you run mktemp -d XXXXX
? Apparently OSX requires the template argument.
But I'm already thinking about how to get rid of it :)
rm -rf
issue fixed, closing.
This script is freakin awesome. I always encounter these problems when working SSL certs.
However, looking through script, the
rm -rf $TMP_DIR
phase is a bit scary. Could this be changed to something less dangerous? I'm no bash pro, so I might just be overly cautious. If something goes wrong in the script or$TMP_DIR
is accidentally set to/
somebody might have a very bad time.Sorry that I can't provide you with a suggested pull request, just wanted to start a discussion. What do you think?