There are many occasions when you want to execute a command and keep the result around. For example, you may want to keep the list of files in the current directory stored in a variable. The commands can be any set of commands. There are conditional expressions and while loops which use Boolean values. Commands act on files and produce visible output.
Every command succeeds or fails.
An exit code holds this value. The exit code is not visible. A value of zero stands for success, anything else for failure. Generally, the exit code is not documented anywhere. The syntax is while commands do commands done The list of commands in the Boolean part is executed each time round the loop.