mirror of
https://github.com/alvinlollo/Single-install-script.git
synced 2026-06-15 03:04:26 +10:00
Fix typos and improve shell change command
This commit is contained in:
@@ -38,6 +38,8 @@ if command -v apt >/dev/null; then
|
|||||||
sudo apt install git curl zsh fzf -y
|
sudo apt install git curl zsh fzf -y
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
zsh=$(which zsh)
|
||||||
|
|
||||||
# Do not print commands
|
# Do not print commands
|
||||||
set +x
|
set +x
|
||||||
echo '
|
echo '
|
||||||
@@ -96,7 +98,7 @@ set +x
|
|||||||
|
|
||||||
# If this user's login shell is already "zsh", do not attempt to switch.
|
# If this user's login shell is already "zsh", do not attempt to switch.
|
||||||
if [ "$(basename -- "$SHELL")" = "zsh" ]; then
|
if [ "$(basename -- "$SHELL")" = "zsh" ]; then
|
||||||
echo "Successfully instaled zsh configuration"
|
echo "Successfully installed zsh configuration"
|
||||||
exit 0 # Exit as success
|
exit 0 # Exit as success
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -108,18 +110,19 @@ fi
|
|||||||
|
|
||||||
echo "Changing your shell to $zsh..."
|
echo "Changing your shell to $zsh..."
|
||||||
|
|
||||||
if ! sudo -k chsh -s "$zsh" "$USER"; then # -k forces password prompt
|
if ! echo "+ sudo -k chsh -s "$zsh" "$USER"" && sudo -k chsh -s "$zsh" "$USER"; then # -k forces password prompt
|
||||||
echo "Next command may fail."
|
echo "Next command may fail."
|
||||||
|
echo "+ chsh -s $"(which zsh)" "$USER""
|
||||||
chsh -s $"(which zsh)" "$USER" # run chsh normally may fail
|
chsh -s $"(which zsh)" "$USER" # run chsh normally may fail
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if the shell change was successful
|
# Check if the shell change was successful
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "chsh command unsuccessful. Change your default shell manually:"
|
echo "chsh command unsuccessful. Change your default shell manually:"
|
||||||
echo "chsh -s $"(which zsh)" $USER"
|
echo "chsh -s $"(which zsh)" "$USER""
|
||||||
else
|
else
|
||||||
export SHELL="$zsh"
|
export SHELL="$zsh"
|
||||||
echo "Shell successfully changed to '$zsh'."
|
echo "Shell successfully changed to '$zsh'."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Successfully installed zsh"
|
echo "Successfully installed zsh"
|
||||||
|
|||||||
Reference in New Issue
Block a user