In this lesson, I'll talk about shell control flow. It's really a form of logic. We use logic all the time in the real-world. A great example would be going to the grocery store. You may want a certain type of milk that's a special milk, organic, or whatever kind of milk like. If it's not available, you'll have a conditional statement in your mind where you say, well, if this milk isn't there, elif I'll pick another kind of milk. It may even be possible the second choice for your milk is unavailable, but you're okay with picking a third option for your milk. Similarly with a shell, it's a very similar scenario. You use tools and you write these conditional statements to handle events so that you can fully automate a pipeline or a workflow. Let's go ahead and take a look at it in a little more detail. Here we have a control flow diagram. You can see there's an if statement, there's an elif statement. In either scenario, you have a command that would run depending on what condition is matched. Notice that down below here in this first if statement, if you can't find, for example, a file, you would then have a false that would be registered. That would go down to the next block, which would be elif. You potentially could look for a second file. Then if you did find the file, you would run a command, maybe it's archive. Then finally, you'll see here that this false statement is really the trigger for this second loop here. Finally, when it's done, you would do the fi, which is the finish of the script. Really, the command itself depends on what part of the branch of code you're in. Again, in the first statement here, if, it would just pass through if you were able to, let's say look for an MP4 file and archive it, then it passes through. If that MP4 file didn't exist, then the second scenario would be this false statement. Really, it's a form of matching on things where you would go through and figure out where you're going to be depending on what part of code the block actually hits, and then it would go through it and pass through to these other conditions. Now notice, if it doesn't have the first two conditions like this if or elif, it would be false yet again, and then you would run some other command. This could be something like if these two files don't exist, maybe send a print statement out to standard out that lets the user know, I can't operate; I need these inputs. Really control flow is very similar to what you would do in the real-world, and it's just a series of steps that allow you to logically get to a conclusion.