SyntaxFix
Write A Post
Hire A Developer
Questions
Use mktemp -d. It creates a temporary directory with a random name and makes sure that file doesn't already exist. You need to remember to delete the directory after using it though.
mktemp -d