-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfirst_time.sh
More file actions
executable file
·42 lines (39 loc) · 852 Bytes
/
first_time.sh
File metadata and controls
executable file
·42 lines (39 loc) · 852 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
38
39
40
41
42
#!/bin/bash
echo Changing current directory to $(dirname $0)
cd $(dirname $0)
function warn() {
echo $(tput setaf 3)$*$(tput sgr 0)
}
function success() {
echo $(tput setaf 2)$*$(tput sgr 0)
}
if [ ! -e ~/bin ]; then
success Making ~/bin
mkdir ~/bin
else
warn ~/bin already created.
fi
if [ ! -e ~/src ]; then
success Making ~/src
mkdir ~/src
else
warn ~/src already created.
fi
echo Copying files to bin directory
for file in bin/*; do
if [ ! -e ~/$file ]; then
success Copying $file to bin
cp $file ~/bin
else
warn ~/$file exists
fi
done
if [ -z "$(grep '\.shell_setup' ~/.bashrc 2> /dev/null)" ]; then
echo "Adding initialization to .bashrc"
echo "
pushd ~/.shell_setup > /dev/null
source bashrc
popd > /dev/null" >> ~/.bashrc
else
warn ~/.bashrc already setup
fi