Closed ifreund closed 4 years ago
Good to know, I'll check this out this weekend. Thanks!
cool, an alternative solution which would better mirror the current behavior would be applying this patch
From 64cce9b35591863658f0afaf54ced68650a94baa Mon Sep 17 00:00:00 2001
From: Isaac Freund <ifreund@ifreund.xyz>
Date: Sat, 22 Feb 2020 17:18:54 +0100
Subject: [PATCH] Remove unneeded mktemp usage
---
zsh-abbr.zsh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/zsh-abbr.zsh b/zsh-abbr.zsh
index 441021e..63b943b 100755
--- a/zsh-abbr.zsh
+++ b/zsh-abbr.zsh
@@ -482,7 +482,7 @@ _zsh_abbr() {
typeset -p ZSH_ABBR_UNIVERSALS > "$ZSH_ABBR_UNIVERSALS_SCRATCH_FILE"
rm "$abbr_universals_updated" 2> /dev/null
- mktemp "$abbr_universals_updated" 1> /dev/null
+ touch "$abbr_universals_updated" 1> /dev/null
for abbreviation expansion in ${(kv)ZSH_ABBR_UNIVERSALS}; do
echo "abbr -a -U -- $abbreviation $expansion" >> "$abbr_universals_updated"
@@ -739,10 +739,10 @@ _zsh_abbr_init() {
fi
# Scratch file
- ZSH_ABBR_UNIVERSALS_SCRATCH_FILE="${TMPDIR}/abbr_universals"
+ ZSH_ABBR_UNIVERSALS_SCRATCH_FILE="${TMPDIR:-/tmp}/abbr_universals"
rm "$ZSH_ABBR_UNIVERSALS_SCRATCH_FILE" 2> /dev/null
- mktemp "$ZSH_ABBR_UNIVERSALS_SCRATCH_FILE" 1> /dev/null
+ touch "$ZSH_ABBR_UNIVERSALS_SCRATCH_FILE" 1> /dev/null
# Load saved universal abbreviations
if [ -f "$ZSH_ABBR_UNIVERSALS_FILE" ]; then
--
2.25.1
Closing this in favor of #3.
GNU mktemp requires a minimum of three X's at the end of the filename.
Also,
$TMPDIR
is usually not defined on linux distributions, in which case/tmp
should be used as a default.https://linux.die.net/man/1/mktemp
Hopefully this still works on mac, I tried to keep it as compatible as possible.