-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup-zsh.sh
executable file
·49 lines (37 loc) · 965 Bytes
/
setup-zsh.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
#!/bin/zsh
apt update
if [ $? -ne 0 ]; then
echo An Error Occured
exit 1
fi
# Install zsh
apt install zsh curl git
if [ $? -ne 0 ]; then
echo An Error Occured
exit 1
fi
# install oh my zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" || true
# exec zsh || true
# intall extensionsion
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions || true
if [ $? -ne 0 ]; then
echo An Error Occured
exit 1
fi
RC_CONFIG=$HOME/.zshrc
## plugins to add
P_REPLACE="plugins=(git sudo dirhistory history jsontools zsh-autosuggestions)"
## get the line number of the plugins
LN=$(cat $RC_CONFIG | grep -n plugins= | grep -v \# | cut -d: -f1)
if [ $? -ne 0 ]; then
echo An Error Occured
exit 1
fi
sed -i.old "${LN}s/.*/${P_REPLACE}/" $RC_CONFIG
if [ $? -ne 0 ]; then
echo An Error Occured
exit 1
fi
source $RC_CONFIG
echo DONE!!!