MH-MKSTEMP(1mh)
π MH-MKSTEMP β bestie edition π
okay so you know the mkstemp command from the nmh manual, section 1mh? yeah. we're doing this. sit down, grab a strawberry π, and let's make a temporary file together, it's literally so easy.
β¨ NAME β¨
mkstemp β create a temporary file π
β¨ SYNOPSIS β¨
/usr/lib/mh/mkstemp [-help] [-version] [-directory directory] [-prefix
prefix] [-suffix suffix]
that's it. that's the whole vibe. she's simple, she's iconic π
β¨ DESCRIPTION β¨
so mkstemp makes you a temporary file β it's using mkstemp(3) under the hood, or mkstemps(3) if the -suffix switch is available and you actually use it. the file name it gives you identifies a unique, newly created file, and no cap it always contains 6 characters that appear to be random. six. every time. π
the -directory switch tells it which directory to create the file in. like, where do you want this lil guy to live bestie π
the -prefix switch sets an initial part of the file name β it goes before those 6 characters. so you can name your temp file something cute instead of it being anonymous.
the -suffix switch, okay listen, this one's conditional β it's only supported on platforms that provide the mkstemps(3) library function. it specifies a suffix to appear after the 6 characters. and heads up: if you want that suffix to begin with a special character like a period, that has to be explicit in suffix β it will not do it for you, it does not read your mind π
and here's the lowkey weird part that's actually so slay: unlike arguments to most switches of other nmh commands, the arguments to mkstemp switches can begin with a dash. fr fr. dashes allowed. wild, I know π
β¨ EXIT STATUS β¨
- if
mkstempsuccessfully creates the temporary file, it prints the file name on standard output and exits with status0. slay. β¨ - on failure, it prints a diagnostic message on standard error and exits with status
1. not slay. π
β¨ PROFILE COMPONENTS β¨
None
nothing. empty. zero. it's giving minimalism π¦
β¨ SEE ALSO β¨
go read those too, they're the main characters of this whole thing iykyk π
β¨ DEFAULTS β¨
-directoryβ current directory-prefixβ none-suffixβ none
reminder bestie: this page is from nmh-1.8, dated 2014-03-16. go make your temp files, you're doing amazing, mwah ππ«ΆπΈ
π¦ where this page comes from
- debian trixie: nmh 1.8-3
- ubuntu noble: nmh 1.8-1build4
- ubuntu questing: nmh 1.8-3
- ubuntu resolute: nmh 1.8-4
- ubuntu stonking: nmh 1.8-4build1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms