Skip to content

Instantly share code, notes, and snippets.

@alexdlaird
Created August 26, 2014 19:20
Show Gist options
  • Save alexdlaird/306837af380eb74061fe to your computer and use it in GitHub Desktop.
Save alexdlaird/306837af380eb74061fe to your computer and use it in GitHub Desktop.
Force default shell to Bash. This is especially useful when user does not exist in /etc/passwd. Place this snippet at the end of /etc/profile or ~/.profile.
case $- in
*i*)
# If $BASH is not defined then we're already in a Bash shell
if [ -z "$BASH" ]; then
BASH_BIN=$(command -v bash)
# Ensure Bash is installed on the system, then switch shells
if [ -x "$BASH_BIN" ]; then
export SHELL="$BASH_BIN"
exec "$BASH_BIN"
fi
fi
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment