-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
37 lines (33 loc) · 1.07 KB
/
install.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
#!/usr/bin/env bash
cd ~/.kube
curl -OL https://raw.githubusercontent.com/lfbear/k/main/k.sh
if [ "$?" -ne "0" ]; then
echo -e "\n\nIt seems that can NOT connect to githubusercontent.com\n"
exit 1
fi
startup_script=""
if [ "$SHELL"=="/bin/zsh" ];then
startup_script=".zshrc"
elif [ "$SHELL"=="/bin/bash" ] || [ "$SHELL"=="/bin/sh" ];then
if [ "$(uname)"=="Darwin" ];then
startup_script=".bash_profile"
else
startup_script=".bashrc"
fi
fi
source $HOME/.kube/k.sh
if [ -z "$startup_script" ];then
tips=$(cat <<EOF
#-----------------------------------------------------------------------------#
| Please copy the following content and add the bottom of your starup script |
#-----------------------------------------------------------------------------#
# alias for kebectl config use-context
source ~/.kube/k.sh
# end of code
EOF
)
echo -e "$tips"
else
echo -e "# alias for kebectl config use-context\nsource ~/.kube/k.sh" >> "${HOME}/$startup_script"
fi
echo "Shell tool [k] install successfully, u can type 'k' in your terminal. 😊"