The Bash manpage says:
After reading that file (/etc/profile), it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable.
So if I have both a
~/.bash_profile and a
~/.profile, only the first will be run.
Because I often share a HOME between different systems I have both, hard linked. On 18.04.2 a login returns to the login screen. With each as a separate but identical file, the same happens. To share between systems and available shells my
.profile contains a
case statement based on
$0, setting up as appropriate or executing a preferred shell. Effectively it does:
case $0 in *bash) ... some stuff ... ;; *) exec /bin/bash -il ;; esac
# before the
exec in the
.profile copy and all works well...
.bash_profile is identical (apart from the
.profile when I insert one).
It turns out that 18.04.2 is quite happy with that
~/.bash_profile, but not in
~/.profile (which it shouldn't be reading anyway). When it's there, logging in takes the password → black screen briefly → login window again. When it's commented out, login happens properly. Also the shell is Bash, so that branch of the case shouldn't be being taken either.