Skip to content

Commit

Permalink
Avoid cp if file doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
marchdf committed Sep 13, 2024
1 parent 3336ab6 commit 0863a4e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion dot_zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ fi
function backup_zsh_history () {
if [ -d "${HIST_BACKUP_DIR}" ]; then
HISTFILE_BAK="${HIST_BACKUP_DIR}/zsh_history_$(date +\%Y_\%m_\%d).bak"
if [ ! -f "${HISTFILE_BAK}" ]; then
if [ ! -f "${HISTFILE_BAK}" ] && [ -f "${HISTFILE}" ]; then
cp "${HISTFILE}" "${HISTFILE_BAK}"
fi
fi
Expand Down

0 comments on commit 0863a4e

Please sign in to comment.