December 2018
Beginner
452 pages
12h 17m
English
Another concept that is very interesting is nesting. In essence, nesting is really simple: it is placing another if-then-else statement within either the then or else of the outer if-then-else. This allows us to, for example, first determine if a file is readable, before determining what type of file it is. By using nested if-then-else statements, we can rewrite the previous code in such a way that we no longer need the || construct:
reader@ubuntu:~/scripts/chapter_11$ vim nested-print-or-list.sh reader@ubuntu:~/scripts/chapter_11$ cat nested-print-or-list.sh #!/bin/bash###################################### Author: Sebastiaan Tammer# Version: v1.0.0# Date: 2018-10-26# Description: Prints or lists the given path, depending on type. ...