Creating a temp file in bash

To create a new temporary file in bash use the mktemp command. E.g.:

  path="$(mktemp)"

There’s a -d argument to mktemp that will make a temp directory.

Leave a Reply