In this recipe, we wrote three scripts for a one-line if statement, for loop, and while loop. In the if example, the condition will be checked and then the output will be displayed on the screen.
In the for loop example, the echo command will be executed 10 times and Hello world will be displayed 10 times on the screen. In the while example, it will be an infinite loop. We have given a sleep of 2 seconds so that the output, 10, will be executed infinitely every 2 seconds.