Skip to content

Commit

Permalink
feat(init, performance): check to see if file exists before deleting
Browse files Browse the repository at this point in the history
  • Loading branch information
olets committed Apr 7, 2020
1 parent 9cd9616 commit 6cc58d3
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions zsh-abbr.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 6cc58d3

Please sign in to comment.