Treffer: Mastering Linux, part 11.
Weitere Informationen
The article presents information related to the Linux computer operating system. The if-then-else control structure will be familiar to anyone who has done any kind of programming or scripting. Shell scripts also support this most basic of control structures. Broken down, this control structure executes certain commands if a condition is true, otherwise it executes another set of commands. The else command is optional and the code contained within this substructure will only be executed if no other test expression has been true. To make one's script easier to read and debug, it is a good idea to use indents to separate sections of the control structure. This is especially necessary when one is working with multiple, nested if-then-else control structures. Nested structures provide more control but get increasingly complicated to work with as the script grows--especially if one forgets the "fi" command in one of the structures. It is usually more efficient to use case control structures.