01 / 08
What was coming back where you could not see
Since chapter 4 you have typed this many times.
~ $ echo $?0$? is the number the command just before handed back.
0 it went wellanything else it did notAnd you have used && and ||.
mkdir box && cd box if it went well, the nextcd box || echo "no good" if it did notIt came up in lesson 3 with if, too.
if grep -q red f; then ... branching on grep's successAll one and the same mechanism. Today you put it in order.
> Every command hands back one number as it ends
This number is called the exit status. You do not usually see it, but it is always flowing.
Three things today.
1. read the number that comes back ($?)2. hand one back from your own tools (exit)3. writing that stands up to failure (set -e and so on)In chapter 12 you make things run while you are not watching. For that you need tools that can notice their own failures. Today is the groundwork.