From your question that is asking to distinguish between two completely different things, I think it would be useful to explain what those things are, and what their respective roles are.
A bootloader is the fist piece of code that runs on a newly booted host (except for a BIOS, in some cases). A bootloader is capable of loading an operating system. It may be very simple in nature, such as an MS-DOS bootloader, or complex and full featured such as grub
. The fact that some bootloaders have an interactive commandline feature makes some people think that they are using a commandline shell, like bash
. Such is not the case, however, and in fact when a bootloader runs, there is no underlying OS (because of course, it is the bootloader's job to load the OS).
A shell is a userspace application that runs by the graces of the underlying OS. In Linux, bash
is the most common of these. A shell requires an OS to support it's functionality. Indeed, a shell is a way of exposing much of the OS kernel's functionality to the user.
At boot-time, typically three different and distinct bits of code run. In order, the bootloader starts the process of booting, followed by the kernel which is loaded by the bootloader. The bootloader invokes the kernel by loading it into memory, and making a jump to the kernel entry point. The bootloader may set up a RAM-based filesystem for initial use by the kernel. The kernel then pokes around at some hardware and generally configures itself, and prepares to invoke the first userspace process. This first userspace process is called the init
process. The name of said process may be hardwired into the kernel, or may be provided to the kernel by the bootloader. It is commonly a dedicated program that reads /etc/inittab
, and uses the instruction found there to initialize the rest of the system (including mounting fileystems). It can be any program accessible by the kernel, and having sufficient resources to function on its own (usually meaning it is statically linked). Sometimes, the init
process is simply a shell, or shell script. Always, the init
process has PID=1, and is therefore the parent of all subsequent processes.
My recommendation for exploring these elements is to set up a virtual machine to load a small simple SO such a TinyCore Linux
. Then, you can explore and modify the init
system (which I find to be quite elegant and simple), and learn the fundamentals. Doing so will teach you fundamentals that can be applied to both larger, more complex, traditional desktop/server systems, as well as scaled-down embedded systems.