dotfiles/copy.sh

33 lines
903 B
Bash
Raw Normal View History

#!/bin/bash
2021-10-06 09:40:58 -04:00
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
moving_files="$(find $SCRIPT_DIR -mindepth 1 -maxdepth 1 -type f -not -name "copy.sh" -not -name "*.git*")"
moving_files=$(echo -e "$moving_files\n$(find $SCRIPT_DIR/.vim/colors/ -mindepth 1)")
home_files=""
for f in $moving_files; do
home_file="$HOME$(echo $f | sed "s@$SCRIPT_DIR@@")"
if test -f "$home_file"; then
home_files="$home_files\n $home_file"
fi
done
if [[ "$home_files" != "" ]]; then
echo -n "Warning! This will overwrite all of the following files:"
echo -e $home_files
read -r -p "Are you sure you want to continue? [y/N] " response
response=${response,,} # tolower
if ! [[ "$response" =~ ^(yes|y)$ ]]; then
exit 1
fi
fi
for f in $moving_files; do
echo "$f => ~/"
2021-10-06 09:40:58 -04:00
ln -sf $f ~/
done
mkdir -p ~/.vim/colors
ln -sf $SCRIPT_DIR/.vim/colors/* ~/.vim/colors/