# Where is the script executed when logging into a shell?

When you login to either a tty or a remote machine by ssh there's normally a banner which looks like this:

Welcome to Ubuntu 12.04 LTS (GNU/Linux 3.2.0-25-generic x86_64)

* Documentation:  https://help.ubuntu.com/

0 packages can be updated.


where is the script/group of scripts that produce this message located? I'd like to customise it.

I assume that it's part of the login process and not bash since you don't see it every time a terminal is opened.

-

Have a look at manpage update-motd(5) and the scripts in /etc/update-motd.d. The text was originally called "Message Of The Day" and stored in /etc/motd (now a symlink to /run/motd). That file is still there and updated as needed by background processes (likely anacron and update-notifier).
This can be suppressed by the presence of a ~/.hushlogin file on a per-user basis.