As the title suggests — can I be reasonably sure that mktemp
will exist on any unix-y operating system I'm likely to encounter?
相关问题
- How to get the return code of a shell script in lu
- Invoking Mirth Connect CLI with Powershell script
- Emacs shell: save commit message
- “command not found” errors in expect script execut
- Python script using subprocess and xclip hangs if
相关文章
- 使用2台跳板机的情况下如何使用scp传文件
- In IntelliJ IDEA, how can I create a key binding t
- shell中反引号 `` 赋值变量问题
- How get the time in milliseconds in FreeBSD?
- Launch interactive SSH bash session from PHP
- Generate disk usage graphs/charts with CLI only to
- How can I create a small IDLE-like Python Shell in
- Pause shell script until user presses enter
A
mktemp
function (AKAmktemp(3)
) first appeared in Unix V7 so it's likely to be everywhere. However, amktemp
command (akamktemp(1)
) first appeared, I believe, on OpenBSD 2.1, so if you have to deal with truly antediluvian Unix systems you might have to worry -- unless you can distribute the very portable mktemp.org version (to fix the potential lack of this utility on some customer's antediluvian system). How likely you are to encounter antediluvian system is nigh impossible for us to guess, of course -- e.g., inHP-UX
,mktemp(1)
has been around for at least 8 years (even most enterprises probably have updated their Unix OS's within that time frame), in Xenix I believe it appeared in 3.0 (in 1992), etc, etc.On Solaris 9 it's in package SMCmktemp, see http://sunfreeware.com/indexsparc9.html:
FYI, mktemp appears to NOT be included with Solaris 9 (released 2002/2003) - just ran across this today:
POSIX does not seem to specify mktemp(1).
It looks like most modern systems have it, but the available functionality and the semantics of the options vary between implementations (so particular invocations may not be portable):
So if you want a portable solution you may need to stick to functionality and options that mean the same thing on all of your platforms of interest.