mktemp: fix common and standardize between variants (#10700)

* mktemp: fix `common` and standardize variants
* mktemp: add -p example
* linux/mktemp: add -p example
* linux/mktemp: mention `$TMPDIR` in the `-p` example
* osx/mktemp: add page
* linux/mktemp: fix errors
* linux/mktemp: add serial comma
This commit is contained in:
pixel
2023-10-03 14:53:31 +02:00
committed by GitHub
parent d8fb645ac2
commit f8d6aa88dc
3 changed files with 56 additions and 17 deletions

View File

@@ -1,16 +1,24 @@
# mktemp
> Create a temporary file or directory.
> More information: <https://ss64.com/osx/mktemp.html>.
> More information: <https://man.openbsd.org/mktemp.1>.
- Create an empty temporary file and print the absolute path to it:
- Create an empty temporary file and print its absolute path:
`mktemp`
- Create an empty temporary file with a given suffix and print the absolute path to file:
- Use a custom directory if `$TMPDIR` is not set (the default is platform-dependent, but usually `/tmp`):
`mktemp --suffix "{{.ext}}"`
`mktemp -p {{/path/to/tempdir}}`
- Create a temporary directory and print the absolute path to it:
- Use a custom path template (`X`s are replaced with random alphanumeric characters):
`mktemp {{/tmp/example.XXXXXXXX}}`
- Use a custom file name template:
`mktemp -t {{example.XXXXXXXX}}`
- Create an empty temporary directory and print its absolute path:
`mktemp -d`