-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathset_links.sh
52 lines (43 loc) · 1.38 KB
/
set_links.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
# This scripts setups links for bashrc and bash_profile
# it backup the previous files (if they are files) and
# create the symlink in place.
# Check file existance and backup
if [ -e "${HOME}/.bashrc" ]; then
mv ${HOME}/.bashrc ${HOME}/.bashrc.ORIGINAL
echo "Old .bashrc moved to .bashrc.ORIGINAL"
fi
if [ -e "${HOME}/.bash_profile" ]; then
mv ${HOME}/.bash_profile ${HOME}/.bash_profile.ORIGINAL
echo "Old .bash_profile moved to .bash_profile.ORIGINAL"
fi
if [ -e "${HOME}/.ssh/config" ]; then
mv ${HOME}/.ssh/config ${HOME}/.ssh/config.ORIGINAL
echo "Old ssh config moved to config.ORIGINAL"
fi
# Check and create symlink
if [ ! -h "${HOME}/.bashrc" ]; then
ln -s ${HOME}/etc/bashrc ${HOME}/.bashrc
echo "Symlink .bashrc created"
else
echo "Symlink .bashrc already exist"
fi
if [ ! -h "${HOME}/.bash_profile" ]; then
ln -s ${HOME}/etc/bash_profile ${HOME}/.bash_profile
echo "Symlink .bash_profile created"
else
echo "Symlink .bash_profile already exist"
fi
if [ ! -h "${HOME}/.ssh/config" ]; then
ln -s ${HOME}/etc/ssh_config ${HOME}/.ssh/config
echo "Symlink .ssh/config created"
else
echo "Symlink .ssh/config already exist"
fi
if [ ! -h "${HOME}/.vimrc" ]; then
ln -s ${HOME}/etc/vimrc ${HOME}/.vimrc
ln -s ${HOME}/etc/vimrc ${HOME}/.config/nvim/init.vim
echo "Symlink .vimrc created"
else
echo "Symlink .vimrc already exist"
fi