forked from mathiasbynens/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsync.sh
executable file
·26 lines (26 loc) · 913 Bytes
/
sync.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/bash
cd "$(dirname "$0")"
function syncDotfiles() {
rsync --include ".bash*" --include ".git*" --exclude ".git" --include ".*rc" --include ".hushlogin" --include ".aliases" \
--include ".functions" --include ".exports" --include ".fzf.bash" --include ".vim" -a . ~
}
function testSyncDotfiles() {
rsync --include ".bash*" --include ".git*" --exclude ".git" --include ".*rc" --include ".hushlogin" --include ".aliases" \
--include ".functions" --include ".exports" --include ".fzf.bash" --include ".vim" -avn . ~
}
if [ "$1" == "--force" -o "$1" == "-f" ]; then
syncDotfiles
elif [ "$1" == "--test" -o "$1" == "-t" ]; then
testSyncDotfiles
else
echo "This will overwrite existing files in your home directory:"
testSyncDotfiles
read -p "Are you sure? (y/n) " -n 1
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo "synchronizing files..."
syncDotfiles
fi
fi
unset syncDotfiles
source ~/.bash_profile