In the documentation for shell-mode:
Emacs sends the new shell the contents of the file
~/.emacs_shellnameas input, if it exists, where shellname is the name of the file that the shell was loaded from. For example, if you use bash, the file sent to it is~/.emacs_bash. If this file is not found, Emacs tries with~/.emacs.d/init_shellname.sh.
Everything works as expected when I enter shell-mode with M-x shell. However, this doesn't work when I call term or ansi-term in Emacs. I have both ~/.emacs_bash and ~/.emacs.d/init_shellname.sh containing export PS1='\h:\W$ ', but the prompt is still bash-3.2$.
How to set a startup shell script for term-mode?