From e312e6abb28818a9569ce693f5e7a3a82c4fc101 Mon Sep 17 00:00:00 2001 From: koalaman Date: Sat, 10 Dec 2016 09:57:53 -0800 Subject: [PATCH] Created SC2186 (markdown) --- SC2186.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 SC2186.md diff --git a/SC2186.md b/SC2186.md new file mode 100644 index 0000000..083ad99 --- /dev/null +++ b/SC2186.md @@ -0,0 +1,24 @@ +## tempfile is deprecated. Use mktemp instead. + +### Problematic code: + +```sh +tmp=$(tempfile) +``` + +### Correct code: + +```sh +tmp=$(mktemp) +``` +### Rationale: + +`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. + +### Exceptions: + +ShellCheck will not recognize when a function overrides this name. \ No newline at end of file