-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlink_dotfiles
More file actions
executable file
·29 lines (23 loc) · 821 Bytes
/
link_dotfiles
File metadata and controls
executable file
·29 lines (23 loc) · 821 Bytes
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
27
28
29
#!/usr/bin/env bash
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # iterate until no longer a symlink
DIR="$(cd -P "$(dirname "$SOURCE")" >/dev/null 2>&1 && pwd)"
SOURCE="$(readlink "$SOURCE")"
# check if relative symlink
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
done
DIR="$(cd -P "$(dirname "$SOURCE")" >/dev/null 2>&1 && pwd)"
link_dotfile_to_home() {
file=${1:?'dotfile name is required'}
echo "linking $file"
ln -s "$DIR/dots/$file" "$HOME/$file"
}
link_dotfile_to_home ".prettierrc"
link_dotfile_to_home ".terraformrc"
link_dotfile_to_home ".nanorc"
link_dotfile_to_home ".bash_completion"
link_dotfile_to_home ".bash_aliases"
link_dotfile_to_home ".bash_wsl"
link_dotfile_to_home ".tmux.conf"
link_dotfile_to_home ".ripgreprc"
echo "remember to source .bash_wsl if you're using wsl"