TEMPFILE(1) | General Commands Manual | TEMPFILE(1) |
tempfile - 安全な一時ファイルの作成
tempfile [-d DIR] [-p STRING] [-s STRING] [-m MODE] [-n FILE] [--directory=DIR] [--prefix=STRING] [--suffix=STRING] [--mode=MODE] [--name=FILE] [--help] [--version]
tempfile creates a temporary file in a safe manner. It uses mkstemps(3) to choose the name and opens it with O_RDWR | O_CREAT | O_EXCL. The filename is printed on standard output.
The directory in which to create the file might be searched for in this order:
終了ステータスが 0 は一時ファイルが正常に作成できたことを意味します。その他の終了ステータスはエラーです。
Exclusive creation is not guaranteed when creating files on NFS partitions. tempfile cannot make temporary directories. tempfile is deprecated; you should use mktemp(1) instead.
#!/bin/sh #[...] t=$(tempfile) || exit trap "rm -f -- '$t'" EXIT #[...] rm -f -- "$t" trap - EXIT exit
倉澤 望 <nabetaro@debian.or.jp>, 2012
Debian JP Documentation ML <debian-doc@debian.or.jp>
27 Jun 2012 | Debian |