1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-22 09:22:07 +02:00

mktemp(linux): improve examples (#10652)

This commit is contained in:
cyqsimon 2023-08-31 21:47:51 +08:00 committed by GitHub
parent 96f185a61c
commit 8695f2cc15
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,16 +1,21 @@
# mktemp # mktemp
> Create a temporary file or directory. > Create a temporary file or directory.
> Note that examples here all assume `$TMPDIR` is unset.
> More information: <https://www.gnu.org/software/autogen/mktemp.html>. > More information: <https://www.gnu.org/software/autogen/mktemp.html>.
- Create an empty temporary file and print the absolute path to it: - Create an empty temporary file in `/tmp/` and print its absolute path:
`mktemp` `mktemp`
- Create an empty temporary file with a given suffix and print the absolute path to file: - Create a temporary directory in `/tmp/` and print its absolute path:
`mktemp --suffix "{{.ext}}"`
- Create a temporary directory and print the absolute path to it:
`mktemp --directory` `mktemp --directory`
- Create an empty temporary file at the specified path, with `X`s replaced with random alphanumeric characters, and print its path:
`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}}"`