-
Notifications
You must be signed in to change notification settings - Fork 1
/
file_checker.sh
executable file
·54 lines (51 loc) · 1.55 KB
/
file_checker.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
53
54
#!/bin/sh
for item in ~/.zshrc ~/.vimrc ~/.gitconfig ~/.gitignore
do
FILE=$item
if test -f "$FILE"; then
printf "\e[32m$FILE exist\e[0m\n"
else
printf "\e[31m$FILE doesn't exist\e[0m\n"
if [ "$HOME/.zshrc" = "~/.zshrc" ]; then
ln -sf $PWD/zsh/zshrc $FILE
echo "\e[35mCreated a file $FILE\e[0m"
fi
if [ "$HOME/.vimrc" = "~/.vimrc" ]; then
ln -sf $PWD/vim/vimrc $FILE
echo "\e[35mCreated a file $FILE\e[0m"
fi
if [ "$HOME/.gitconfig" = "~/.gitconfig" ]; then
ln -sf $PWD/git/gitconfig $FILE
echo "\e[35mCreated a file $FILE\e[0m"
fi
if [ "$HOME/.gitignore" = "~/.gitignore" ]; then
ln -sf $PWD/git/gitignore $FILE
echo "\e[35mCreated a file $FILE\e[0m"
fi
fi
done
for item in ~/.zsh ~/.vim
do
FILE=$item
if test -d "$FILE"; then
printf "\e[32m$FILE exist\e[0m\n"
else
printf "\e[31m$FILE doesn't exist\e[0m\n"
if [ "$HOME/.zsh" = "$FILE" ]; then
ln -sf $PWD/zsh $FILE
echo "\e[35mCreated a file $FILE\e[0m"
fi
if [ "$HOME/.vim" = "$FILE" ]; then
ln -sf $PWD/vim $FILE
echo "\e[35mCreated a file $FILE\e[0m"
fi
fi
done
FILE=/usr/bin/python
if test -f "$FILE"; then
printf "\e[32m$FILE exist\e[0m\n"
else
printf "\e[31m$FILE doesn't exist\e[0m\n"
sudo ln -sf $PWD/python3.8 /usr/bin/python
echo "\e[35mRan sudo ln -sf $PWD/python3.8 /usr/bin/python $FILE\e[0m"
fi