We generally collect a set of commands used in performing an operation in a file, called a shell script in the Unix world and batch file in Windows. The commands present in these files are executed sequentially, with the exceptions being when you have conditional blocks or loops in the scripts.
These shell scripts are evaluated by the shell in which they get executed. Different types of shells available are bash, csh, ksh, and so on. The bash shell is the most commonly used shell.
In this recipe, we will write a simple shell script and then invoke the same from the Java code using the ProcessBuilder and Process objects.