From 864e372ce78c6e2c027bf525ea9eae1dfd0ddb0a Mon Sep 17 00:00:00 2001 From: Jesse Byler Date: Wed, 10 Jun 2015 16:20:09 -0700 Subject: Fix mktemp invocation to work on Mac OS X and Linux mktemp on Mac OS X (and probably all BSDs) just returns an error when invoked without any arguments. The -t option used in this change is interpreted differently on Mac OS X and Linux, and is deprecated on Linux, but this invocation works as expected on both. See discussion at https://unix.stackexchange.com/questions/30091 Another alternative would be to use Python's tempfile module: https://docs.python.org/2/library/tempfile.html --- examples/bash_automatic_cd.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples') diff --git a/examples/bash_automatic_cd.sh b/examples/bash_automatic_cd.sh index ac96ea12..040bf21a 100644 --- a/examples/bash_automatic_cd.sh +++ b/examples/bash_automatic_cd.sh @@ -8,7 +8,7 @@ # original directory. function ranger-cd { - tempfile="$(mktemp)" + tempfile="$(mktemp -t tmp.XXXXXX)" /usr/bin/ranger --choosedir="$tempfile" "${@:-$(pwd)}" test -f "$tempfile" && if [ "$(cat -- "$tempfile")" != "$(echo -n `pwd`)" ]; then -- cgit 1.4.1-2-gfad0