-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall_dotfiles.sh
More file actions
executable file
·60 lines (49 loc) · 1.41 KB
/
install_dotfiles.sh
File metadata and controls
executable file
·60 lines (49 loc) · 1.41 KB
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
53
54
55
56
57
58
59
60
#!/bin/bash
# Install dotfiles
#
bkupdir=dotfile_backups
cd ~
mkdir $bkupdir
echo "Backing up existing .bash* files to ~/$bkupdir"
# If link exists, just delete it
# else, if file exists, back it up.
if [ -L .bash_profile ]; then
rm .bash_profile
elif [ -f .bash_profile ]; then
mv .bash_profile $bkupdir/.bash_profile
fi
if [ -L .bashrc ]; then
rm .bashrc
elif [ -f .bashrc ]; then
mv .bashrc $bkupdir/.bashrc
fi
if [ -L .bash_aliases ]; then
rm .bash_aliases
elif [ -f .bash_aliases ]; then
mv .bash_aliases $bkupdir/.bash_aliases
fi
if [ -L .bash_exports ]; then
rm .bash_exports
elif [ -f .bash_exports ]; then
mv .bash_exports $bkupdir/.bash_exports
fi
if [ -L .bash_logout ]; then
rm .bash_logout
elif [ -f .bash_logout ]; then
mv .bash_logout $bkupdir/.bash_logout
fi
echo "Creating links to dotfiles"
# Create links to the dotfiles version
ln -s dotfiles/.bash_profile .bash_profile
ln -s dotfiles/.bashrc .bashrc
ln -s dotfiles/.bash_aliases .bash_aliases
ln -s dotfiles/.bash_exports .bash_exports
ln -s dotfiles/.bash_logout .bash_logout
localbashfiles=.bashrc.d
echo "Creating $localbashfiles dir."
echo "Files in this directory will be sourced when .bashrc is read."
echo "These files are sourced AFTER the standard .bash* files so"
echo "your settings can override anything set prior."
echo
echo "Place any environment specific files in this directory."
mkdir $localbashfiles