2022-03-16 17:02:09 +00:00
|
|
|
# mktemp
|
|
|
|
|
|
|
|
> Create a temporary file or directory.
|
2023-08-31 14:47:51 +01:00
|
|
|
> Note that examples here all assume `$TMPDIR` is unset.
|
2022-03-16 17:02:09 +00:00
|
|
|
> More information: <https://www.gnu.org/software/autogen/mktemp.html>.
|
|
|
|
|
2023-08-31 14:47:51 +01:00
|
|
|
- Create an empty temporary file in `/tmp/` and print its absolute path:
|
2022-03-16 17:02:09 +00:00
|
|
|
|
|
|
|
`mktemp`
|
|
|
|
|
2023-08-31 14:47:51 +01:00
|
|
|
- Create a temporary directory in `/tmp/` and print its absolute path:
|
2022-03-16 17:02:09 +00:00
|
|
|
|
2023-08-31 14:47:51 +01:00
|
|
|
`mktemp --directory`
|
2022-03-16 17:02:09 +00:00
|
|
|
|
2023-08-31 14:47:51 +01:00
|
|
|
- Create an empty temporary file at the specified path, with `X`s replaced with random alphanumeric characters, and print its path:
|
2022-03-16 17:02:09 +00:00
|
|
|
|
2023-08-31 14:47:51 +01:00
|
|
|
`mktemp "{{path/to/file_XXXXX_name}}"`
|
|
|
|
|
|
|
|
- Create an empty temporary file in `/tmp/` with the specified name, with `X`s replaced with random alphanumeric characters, and print its path:
|
|
|
|
|
|
|
|
`mktemp -t "{{file_XXXXX_name}}"`
|