-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup-zsh.zsh
executable file
·48 lines (34 loc) · 1.34 KB
/
setup-zsh.zsh
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
#!/usr/bin/env zsh
echo "\n~~~ Starting ZSH Setup ~~~\n"
# Installation unnecessary; it's already in Brewfile.
# https://stackoverflow.com/a/4749368/1341838
if grep -Fxq '/usr/local/bin/zsh' '/etc/shells'; then
echo '/usr/local/bin/zsh already exists in /etc/shells'
else
# echo "Enter password to add /usr/local/bin/zsh to /etc/shells"
# echo "Enter sudo password to edit /etc/shells"
echo "sudo password required to edit /etc/shells"
echo '/usr/local/bin/zsh' | sudo tee -a '/etc/shells' >/dev/null
fi
if [ "$SHELL" = '/usr/local/bin/zsh' ]; then
echo '$SHELL is already /usr/local/bin/zsh'
else
# echo "Enter password to change login shell to /usr/local/bin/zsh"
# echo "Enter user password to change login shell"
echo "user password required to change login shell"
chsh -s /usr/local/bin/zsh
fi
# if command ls -la /private/var/select/sh | grep -q /bin/zsh; then
if sh --version | grep -q zsh; then
echo '/private/var/select/sh already linked to /bin/zsh'
else
# Looked cute, might delete later, idk
sudo ln -sfv /bin/zsh /private/var/select/sh
# I'd like for this to work instead.
# sudo ln -sfv /usr/local/bin/zsh /private/var/select/sh
fi
# Look into later:
# /usr/local/Cellar/zsh/5.8/share/zsh/functions
# These are aliased to 5.8. What where they before
# I updated with Homebrew?
# /usr/local/share/zsh/functions