Skip to content

Instantly share code, notes, and snippets.

@jaxvanyang
Last active August 24, 2023 05:18
Show Gist options
  • Save jaxvanyang/36fba71437be93ee4670f571900eba51 to your computer and use it in GitHub Desktop.
Save jaxvanyang/36fba71437be93ee4670f571900eba51 to your computer and use it in GitHub Desktop.
Workaround for changing the default shell if you don't have write permission of `/etc/passwd`.
# change default shell from Bash to fish
if shopt -q login_shell; then
if ! command -v fish &> /dev/null; then
return
fi
clear
export SHELL=/usr/bin/fish
# clean Bash envs
unset -v HISTFILE HISTSIZE HISTTIMEFORMAT
exec /usr/bin/fish
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment