create a file with prefix =file1 followed by the random number
You want to test the existence with -f and then create a file. But what happens, if between test and creation another task creates the file? mktemp can resolve this problem: filename=$( mktemp ./file1-XXXXXXXXXX ) || exit 1 In this case, an empty file is created (like using touch). The XXXXXXXXXX part is replaced by … Read more