1
0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2026-04-02 20:04:35 +08:00
This commit is contained in:
Daniel Bates 2026-03-18 12:34:11 -04:00 committed by GitHub
commit 0542709a1f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -473,7 +473,10 @@ EOF
# be prompted for the password either way, so this shouldn't cause any issues.
#
if user_can_sudo; then
sudo -k chsh -s "$zsh" "$USER" # -k forces the password prompt
# Use -k to invalidate cached credentials (forces password prompt).
# Some sudo shims (e.g. doas-sudo-shim on Alpine) don't support -k,
# so fall back to running without it.
sudo -k chsh -s "$zsh" "$USER" 2>/dev/null || sudo chsh -s "$zsh" "$USER"
else
chsh -s "$zsh" "$USER" # run chsh normally
fi