-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall
More file actions
executable file
·37 lines (26 loc) · 966 Bytes
/
Copy pathinstall
File metadata and controls
executable file
·37 lines (26 loc) · 966 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
30
31
32
33
34
35
36
37
#!/usr/bin/env bash
function current_shell() {
ps -co 'comm=' $$ | tr -d '-'
}
export DOTFILES="$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd )"
cd $DOTFILES
# source shell env inside .zshrc .bash_profile and .bashrc
printf "\nInstalling dotfiles at ${DOTFILES}…\n"
if [[ $(current_shell) == 'zsh' ]]; then
touch ~/.zshrc
if ! grep -Fq "# edit dotfiles in" ~/.zshrc ; then
echo -e "# edit dotfiles in $DOTFILES \nsource $DOTFILES/env" >> ~/.zshrc
fi
fi
if [[ $(current_shell) == 'bash' ]] || [ -f ~/.bash_profile ] || [ -f ~/.bashrc ]; then
touch ~/.bashrc
if ! grep -Fq "source $DOTFILES/env" ~/.bashrc ; then
echo -e "# edit dotfiles in $DOTFILES \nsource $DOTFILES/env" >> ~/.bashrc
fi
fi
# source shell env, and run help command
source $DOTFILES/env
echo ""
dotfiles files
echo ""
dotfiles help