In this article, we will take a look at how to use a break and continue in bash scripts. In bash, we have three main loop constructs (for, while, until). Break and continue statements are bash builtin and used to alter the flow of your loops. This concept of break and continue are available in
Shell Scripting - DesignLinux
How to Use until Loop in Your Shell Scripts
In bash for, while, and until are three loop constructs. While each loop differs syntactically and functionally their purpose is to iterate over a block of code when a certain expression is evaluated. Until loop is used to execute a block of code until the expression is evaluated to be false. This is exactly the
Different Ways to Read File in Bash Script Using While Loop
This article is all about how to read files in bash scripts using a while loop. Reading a file is a common operation in programming. You should be familiar with different methods and which method is more efficient to use. In bash, a single task can be achieved in many ways but there is always
How to Use Heredoc in Shell Scripting
Here document (Heredoc) is an input or file stream literal that is treated as a special block of code. This block of code will be passed to a command for processing. Heredoc originates in UNIX shells and can be found in popular Linux shells like sh, tcsh, ksh, bash, zsh, csh. Notably, other programming languages
Learn Difference Between Sourcing and Forking in Bash
The main focus of this article is to clearly understand what happens when you run the script vs source the script in bash. First, we will clearly understand how the program is submitted when you call the script in different ways. NOTE: creating the script with an extension doesn’t matter. Script will run fine even
Learn Difference Between $$ and $BASHPID in Bash
Recently I was working on a shell script and I saw a significant difference in how bash special variable $ and BASHPID behaves. Every process running in Linux will be assigned with a process ID and that is how the operating system handles the process. Similarly, your bash terminal session will also be assigned with
How to Create Simple Shell Scripts in Linux
Creating shell scripts is one of the most essential skills that Linux users should have at the tip of their fingers. Shell scripts play an enormous role in automating repetitive tasks which otherwise would be tedious executing line by line. In this tutorial, we highlight some of the basic shell scripting operations that every Linux