diff options
author | Marc Cornellà <hello@mcornella.com> | 2022-02-25 14:06:19 +0100 |
---|---|---|
committer | Marc Cornellà <hello@mcornella.com> | 2022-02-25 14:06:19 +0100 |
commit | c81804825c03e563ab748aae84c3f63458961208 (patch) | |
tree | 90679907c12bad620e5b81a81e2377671d28d88e | |
parent | 99460351eb8d8d9d5ea2e44b66e1b9ceaaa4a368 (diff) | |
download | zsh-c81804825c03e563ab748aae84c3f63458961208.tar.gz zsh-c81804825c03e563ab748aae84c3f63458961208.tar.bz2 zsh-c81804825c03e563ab748aae84c3f63458961208.zip |
fix(installer): fix removal of OMZ directory on failure
When the `git init` call fails, the directory is not created,
so the rm command fails with a not found error. This change
checks whether the directory exists before deleting it.
-rwxr-xr-x | tools/install.sh | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/install.sh b/tools/install.sh index 7953ad112..93608eb7c 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -283,7 +283,7 @@ setup_ohmyzsh() { && git remote add origin "$REMOTE" \ && git fetch --depth=1 origin \ && git checkout -b "$BRANCH" "origin/$BRANCH" || { - rm -rf "$ZSH" + [ ! -d "$ZSH" ] || rm -rf "$ZSH" 2>/dev/null fmt_error "git clone of oh-my-zsh repo failed" exit 1 } |