This commit is contained in:
Stephan Raabe
2023-11-12 14:16:53 +01:00
parent 339d7b8411
commit 86dff9bf64
4 changed files with 34 additions and 9 deletions

View File

@@ -3,7 +3,7 @@
# ------------------------------------------------------
datets=$(date '+%Y%m%d%H%M%S')
if [ -d ~/dotfiles ]; then
if [ -d ~/dotfiles ] || [ -f ~/.bashrc ]; then
cat <<"EOF"
____ _
@@ -14,8 +14,12 @@ ____ _
|_|
EOF
echo "The script has detected an existing dotfiles folder and will try to create a backup into the folder ~/dotfiles-versions/backups/$datets"
if [ -d ~/dotfiles ]; then
echo "The script has detected an existing dotfiles folder and will try to create a backup into the folder ~/dotfiles-versions/backups/$datets"
fi
if [ -f ~/.bashrc ]; then
echo "The script has detected an existing .bashrc file and will try to create a backup ~/dotfiles-versions/backups/$datets/.bashrc-old"
fi
echo ""
while true; do
read -p "Do you want to proceed? (Yy/Nn): " yn
@@ -29,6 +33,10 @@ EOF
mkdir ~/dotfiles-versions/backups
echo "~/dotfiles-versions/backups created"
fi
if [ ! -d ~/dotfiles-versions/backups/$datets ]; then
mkdir ~/dotfiles-versions/backups/$datets
echo "~/dotfiles-versions/backups/$datets created"
fi
if [ -d ~/dotfiles ]; then
cp -r ~/dotfiles ~/dotfiles-versions/backups/$datets
echo "Backup of your current dotfiles in ~/dotfiles-versions/backups/$datets created."