I want to know how I can run
bash automatically when I log into my AIX server. How can I do that without having to type
bash every time I log into my AIX server?
You normally would run
chsh (see for example Changing Shells on IBM AIX). However, if
bash is not listed in these files, then you could break your login:
- /etc/shells and
As a workaround, you could make your shell's login initialization script run
bash directly. That would work if your shell is
csh, for instance, by modifying
If your login shell is
ksh, that is a little harder: AIX's ksh uses
.profile (which is used by other shells), and does not set special variables. Something like this might work for you, in
[ $SHLVL = 1 ] && exec bash
Both ksh and bash set this variable; it should be
1 as you just log in, and incremented when you transfer to bash.
When experimenting with things like this, it is important to have a workable shell on the remote machine, and test logins using a different connection, in case there is a problem with your edits.
Thomas reminded me of this. I use several AIX servers and not all servers have bash. I do prefer bash though. I put this in my .profile.
case $- in *i*) # Interactive session. Try switching to bash. if [ -z "$BASH" ]; then # do nothing if running under bash already bash=$(command -v bash) if [ -x "$bash" ]; then export SHELL="$bash" exec "$bash" fi fi esac