Just for future reference, here's what I do on multiple machines if I want bash:
Code:
cat >> ~/.shrc <<EOF
if [ -x /usr/local/bin/bash ]; then
/usr/local/bin/bash -c true && exec /usr/local/bin/bash
fi
EOF
I realize it might seem excessive, but here's a breakdown:
NOTE: $- maps to the flags passed to bash/sh. -i is passed with interactive logins (and that's the only case I want to deal with in an interactive shell), and it would be present in the string, so I could check like so:
Code:
case "$-" in
*i*)
echo "hello interactive user"
;;
esac
However, .shrc isn't executed unless it's an interactive login, so this is moot. It's a better check than looking for PS1, etc (that's another method, but it's more faulty). See sh(1) for more details on this.
1.
Code:
[ -x /usr/local/bin/bash ]
checks to make sure that the shell is present (this would fail most of the time in single-user mode).
2.
Code:
/usr/local/bin/bash -c true
checks to make sure that the shell isn't broken; this is to avoid the case where I do a port upgrade and break bash by accident -- I can still login with my non-privileged account via ssh.
With recent copies of CURRENT though (circa May/June?) I don't need to install bash though because sh(1) functions `properly' with history input, tab completion, etc thanks to jilles@ work in porting bits over from NetBSD..