Skip to content

Files

Latest commit

 

History

History
30 lines (18 loc) · 648 Bytes

SC2186.md

File metadata and controls

30 lines (18 loc) · 648 Bytes

Pattern: Use of deprecated tempfile

Issue: -

Description

tempfile is a Debian specific utility for creating temporary files. Its man page notes:

tempfile is deprecated; you should use mktemp(1) instead.

Neither tempfile nor mktemp are POSIX, but tempfile is Debian specific while mktemp works on GNU, OSX, BusyBox, *BSD and Solaris.

Example of incorrect code:

tmp=$(tempfile)

Example of correct code:

tmp=$(mktemp)

Exceptions

ShellCheck will not recognize when a function overrides this name.

Further Reading