Bash Scripting and Bash Shell
Bash shell is a software application known as the shell that offers Linux command line management. The shell program has changed through the years to accommodate different options. Bash is powerful because it can streamline tasks that are challenging to complete effectively using a GUI. Keep in mind that not all servers offer a graphical user interface (GUI), thus it is best to learn how to use a command line interface (CLI).
When a shell is used interactively, it will show information, like username, host, and a $ when it is awaiting a command from the user. This is known as the shell prompt.
[username@host ~]$
If the shell is running as the root user, the prompt will end with the # symbol.
[root@host ~]#
It is possible to set up different users to use various shells. But the majority of users choose to continue using the current standard shell. The GNU Bourne-Again Shell is the standard shell for many Linux distributions (bash). Bourne Shell succeeds Bash (sh). The startup script used by the shell when it is first launched may be found in the .bashrc or .bash profile file and allows you to modify how the shell behaves.
You can use nano to edit the add your script in bashrc config to load in a terminal startup.
We write the bash script which is work on the bash shell, so we can use another shell but we should switch to the bash shell instead for running the bash scripts. The startup script written in bashrc may face conflict with other shells or will not be loaded in another shell.
Bash Scripting – Working of Bash Scripting
Bash Scripting is a crucial component of Linux’s process automation. You can write a series of commands in a file and then execute them using scripting. A Bash script is a plain text file with a set of commands inside of it. These commands are a combination of ones we typically type on the command line ourselves (like ls or cp, for instance) and others that we could type on the command line but typically wouldn’t. Any command that can be executed regularly on the command line can be put into a script and will execute exactly as intended. Likewise, whatever you can include in a script can also be executed regularly on the command line and will provide the same results. You can save time by not having to repeatedly type specific commands as a result. Daily duties can be completed effectively and even scheduled for automated completion. Additionally, you can configure some scripts to run at startup, such as those that display a specific message when a new session is started or modify the environment.