CLI Flow Control

From FreekiWiki
Revision as of 13:43, 8 March 2008 by Rwlove (talk | contribs)
Jump to navigation Jump to search

Introduction

The command line interpreter (BASH) is the program that runs when you hit enter on the command line. It is what knows how to find the command that you've asked it to run and it passes the options and arguments that you typed to that command to execute. However BASH is much more than just a command line interpreter. It's also a programming language. This means that you can use flow control techniques to guide the execution flow of your commands. Wow, that was wordy, what did I mean? What I mean is that you can use some techniques to decide if you want to run a command or possibly to run a command many times in a loop. Let's look at some simple examples.


Flow Control Techniques

if/then statement