From 5f4927b3e06d00ea9e369cbfb08b4a7312128875 Mon Sep 17 00:00:00 2001 From: Christian Colglazier Date: Sun, 22 Sep 2019 21:34:07 -0400 Subject: [PATCH] Dotfiles setup --- scripts/dotfiles.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/scripts/dotfiles.sh b/scripts/dotfiles.sh index 033e3bc..a154768 100644 --- a/scripts/dotfiles.sh +++ b/scripts/dotfiles.sh @@ -4,13 +4,22 @@ files=(~/.zshrc ~/.config/.dotfiles/.zshrc 'n') for (( i=0; i<${#files[@]} ; i+=3 )) ; do + if [ -f ${files[i+1]} ]; then + if [[ ${files[i+2]} == *'y'* ]]; then + rm ${files[i]}.bak + sudo mv ${files[i]} ${files[i]}.bak + else + rm ${files[i]}.bak + mv ${files[i]} ${files[i]}.bak + fi + fi if [[ $* == *-b* ]]; then cp ${files[i]} ${files[i+1]} else if [[ ${files[i+2]} == *'y'* ]]; then - sudo cp ${files[i+1]} ${files[i]} + sudo ln -sf ${files[i+1]} ${files[i]} else - cp ${files[i+1]} ${files[i]} + ln -sf ${files[i+1]} ${files[i]} fi fi done