-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·55 lines (42 loc) · 1.11 KB
/
install.sh
File metadata and controls
executable file
·55 lines (42 loc) · 1.11 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
#!/bin/bash
NC='\033[0m' # No Color
RED='\033[0;31m'
GREEN='\033[0;32m'
OK="[${GREEN}OK${NC}]"
ERR="[${RED}ERR${NC}]"
std_path="$HOME/.bin/"
sh=echo $SHELL | cut -d'/' -f2-
TITLE="Installing bash_scripts-git"
function write_to_rc(shell)
{
shell_config = "~/."+$sh+"rc"
echo "# EXPORT VARIABLE BY m_scripts \n" >> shell_config
echo 'export APP=/"$std_path"' >> shell_config
printf "${OK} Added export to $shell_config"
}
function detect_shell(shell)
{
valid = $(case $shell in
"bash") write_to_rc($shell) ;;
"zsh") write_to_rc($shell ;;
*) echo valid=false ;;
esac)
return valid
}
main()
{
if [ ! -d "std_path" ];then
cd $HOME && mkdir .bin
printf "${OK} Created Directory $HOME/.bin/"
echo "Your stdshell is : $SHELL"
if [ ! detect_shell($sh) ]
printf "${ERR} Your shell is currently not supported for adding the script directory to your path.\n"
fi
echo "Cloning repository ..."std_path = "$HOME/.bin/"
git clone https://github.com/WDF-VIORuleZ/bash_scripts-git.git
else
echo "[ERR] Directory $std_path already exists. Mission abort."
exit
fi
}
main()