From 6cc58d3537f7514a5bd0e29af1488cb986ad1d28 Mon Sep 17 00:00:00 2001 From: Henry Bley-Vroman Date: Sun, 5 Apr 2020 13:07:10 -0400 Subject: [PATCH] feat(init, performance): check to see if file exists before deleting --- zsh-abbr.zsh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/zsh-abbr.zsh b/zsh-abbr.zsh index f91d01b0..816a1fa4 100755 --- a/zsh-abbr.zsh +++ b/zsh-abbr.zsh @@ -831,11 +831,17 @@ _zsh_abbr_init() { mkdir -p ${TMPDIR:-/tmp/}zsh-abbr - rm ${TMPDIR:-/tmp/}zsh-abbr/regular-user-abbreviations 2> /dev/null + if [ -f ${TMPDIR:-/tmp/}zsh-abbr/regular-user-abbreviations ]; then + rm ${TMPDIR:-/tmp/}zsh-abbr/regular-user-abbreviations + fi + + if [ -f ${TMPDIR:-/tmp/}zsh-abbr/global-user-abbreviations ]; then + rm ${TMPDIR:-/tmp/}zsh-abbr/global-user-abbreviations + fi + touch ${TMPDIR:-/tmp/}zsh-abbr/regular-user-abbreviations chmod 600 ${TMPDIR:-/tmp/}zsh-abbr/regular-user-abbreviations - rm ${TMPDIR:-/tmp/}zsh-abbr/global-user-abbreviations 2> /dev/null touch ${TMPDIR:-/tmp/}zsh-abbr/global-user-abbreviations chmod 600 ${TMPDIR:-/tmp/}zsh-abbr/global-user-abbreviations }