So far, we have launched commands by directly typing into the shell and pressing Enter, but it's also possible to use a text file for writing a set of commands and launch this file through the shell. This technique allows us to create scripts or small applications for launching commands or executing different shell operations. In fact, the Bash shell offers us a particular domain-specific programming language for this purpose. Although the learning curve for this specific programming language is not trivial, we're going to learn how to create a simple Bash script for executing some commands using control structures.
In our example, we'll create a script for checking whether a text file exists. If the answer is in the affirmative, we'll launch a message informing you about it. Otherwise, we'll create a new text file with a single line. Finally, whatever happens, we'll list the created text file.