-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_shell.sh
More file actions
executable file
·126 lines (106 loc) · 3.39 KB
/
setup_shell.sh
File metadata and controls
executable file
·126 lines (106 loc) · 3.39 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
sudo apt install curl -y
#!/bin/bash
# Check if Zsh is already installed
if command -v zsh >/dev/null 2>&1; then
echo "Zsh is already installed."
else
echo "Zsh is not installed. Installing Zsh..."
# Update package list and install Zsh
sudo apt update
sudo apt install -y zsh
# Verify installation
if zsh --version >/dev/null 2>&1; then
echo "Zsh installed successfully."
else
echo "Failed to install Zsh."
exit 1
fi
fi
# Check if Zsh is already the default shell
current_shell=$(echo $SHELL)
if [[ "$current_shell" == *"zsh"* ]]; then
echo "Zsh is already the default shell."
else
echo "Setting Zsh as the default shell..."
# Set Zsh as default shell
sudo chsh -s $(which zsh) $USER
echo "Please log out and log back in to use Zsh as your default shell."
fi
#!/bin/bash
# Function to display messages in green
function display_message {
echo -e "\033[0;32m$1\033[0m"
}
# Check if Zsh is installed
if command -v zsh >/dev/null 2>&1; then
display_message "Zsh is already installed."
else
display_message "Zsh is not installed. Installing Zsh..."
sudo apt update
sudo apt install -y zsh
# Verify Zsh installation
if zsh --version >/dev/null 2>&1; then
display_message "Zsh installed successfully."
else
display_message "Failed to install Zsh."
exit 1
fi
fi
# Check if Tilda is installed
if command -v tilda >/dev/null 2>&1; then
display_message "Tilda is already installed."
else
display_message "Tilda is not installed. Installing Tilda..."
sudo apt install -y tilda
# Verify Tilda installation
if command -v tilda >/dev/null 2>&1; then
display_message "Tilda installed successfully."
else
display_message "Failed to install Tilda."
exit 1
fi
fi
# Check if tmux is installed
if command -v tmux >/dev/null 2>&1; then
display_message "Tmux is already installed."
else
display_message "Tmux is not installed. Installing tmux..."
sudo apt install -y tmux
# Verify tmux installation
if command -v tmux >/dev/null 2>&1; then
display_message "Tmux installed successfully."
else
display_message "Failed to install Tmux."
exit 1
fi
fi
# Check if Zsh is already the default shell
current_shell=$(echo $SHELL)
if [[ "$current_shell" == *"zsh"* ]]; then
display_message "Zsh is already the default shell."
else
display_message "Setting Zsh as the default shell..."
sudo chsh -s $(which zsh) $USER
display_message "Zsh has been set as the default shell. Please log out and log back in."
fi
# Move the configuration files to the home directory
if [ -f "zsh" ]; then
display_message "Copying zsh to ~/.zsh..."
mv zsh ~/.zsh
else
display_message "zsh file not found in the current directory."
fi
if [ -f "zshenv" ]; then
display_message "Copying zshenv to ~/.zshenv..."
mv zshenv ~/.zshenv
else
display_message "zshenv file not found in the current directory."
fi
if [ -f "tmux.conf" ]; then
display_message "Copying tmux.conf to ~/.tmux.conf..."
mv tmux.conf ~/.tmux.conf
else
display_message "tmux.conf file not found in the current directory."
fi
display_message "Setup complete! Please log out and log back in to start using Zsh as the default shell with your configurations."
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"