Implement dir checking logic

This commit is contained in:
nnyyxxxx 2024-09-14 08:07:22 -04:00
parent 8ed2265463
commit 55c6db1b12
2 changed files with 8 additions and 0 deletions

View File

@ -5,6 +5,10 @@
gitpath="$HOME/.local/share/mybash" gitpath="$HOME/.local/share/mybash"
cloneMyBash() { cloneMyBash() {
# Check if the dir exists before attempting to clone into it.
if [ -d "$gitpath" ]; then
rm -rf "$gitpath"
fi
mkdir -p "$HOME/.local/share" # Only create the dir if it doesn't exist. mkdir -p "$HOME/.local/share" # Only create the dir if it doesn't exist.
cd "$HOME" && git clone https://github.com/ChrisTitusTech/mybash.git "$gitpath" cd "$HOME" && git clone https://github.com/ChrisTitusTech/mybash.git "$gitpath"
} }

View File

@ -5,6 +5,10 @@
gitpath="$HOME/.local/share/neovim" gitpath="$HOME/.local/share/neovim"
cloneNeovim() { cloneNeovim() {
# Check if the dir exists before attempting to clone into it.
if [ -d "$gitpath" ]; then
rm -rf "$gitpath"
fi
mkdir -p "$HOME/.local/share" # Only create the dir if it doesn't exist. mkdir -p "$HOME/.local/share" # Only create the dir if it doesn't exist.
cd "$HOME" && git clone https://github.com/ChrisTitusTech/neovim.git "$HOME/.local/share/neovim" cd "$HOME" && git clone https://github.com/ChrisTitusTech/neovim.git "$HOME/.local/share/neovim"
} }