-
Notifications
You must be signed in to change notification settings - Fork 0
/
install
executable file
·57 lines (48 loc) · 1.03 KB
/
install
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
#! /bin/bash
if which todo; then
echo "todo is already installed."
exit 1
fi
echo "Do you care where I install todo?[Y/N]"
read CARE
if [ $CARE = 'Y' ]
then
echo "Where do you want to install todo?"
read DEST
if [ ! -d $DEST ]
then
echo "Directory does not exist: $DEST"
echo "Using default: $HOME/bin"
DEST="$HOME/bin"
fi
else
echo "Using default: $HOME/bin"
DEST="$HOME/bin"
fi
echo "Installing in: $DEST"
if [ ! -d $DEST ]
then
mkdir -p $DEST
fi
cp todo kv-bash $DEST
if [[ ":$PATH:" == *":$DEST:"* ]]
then
echo "$DEST is on PATH"
else
echo "Adding $DEST to PATH"
if [ ! -f ~/.bashrc ]
then
touch ~/.bashrc
fi
if [ ! -f ~/.bash_profile ]
then
touch ~/.bash_profile
fi
echo "PATH=\$PATH:$DEST # For todo" >> ~/.bashrc
echo "PATH=\$PATH:$DEST # For todo" >> ~/.bash_profile
fi
source ~/.bash_profile
source ~/.bashrc
todo clear
echo "Please relaunch your terminal"
echo "Or run source ~/.bashrc; source ~/.bash_profile"