December 2018
Beginner
452 pages
12h 17m
English
A function can have as many commands as needed. In our simple example, we only added a single echo, which we then only called once. While this is nice for abstraction, it does not really warrant creating a function (yet). Let's look at a more complex example that will give you a better idea why abstraction of commands in functions is a good idea:
reader@ubuntu:~/scripts/chapter_13$ vim complex-function.sh reader@ubuntu:~/scripts/chapter_13$ cat complex-function.sh #!/bin/bash###################################### Author: Sebastiaan Tammer# Version: v1.0.0# Date: 2018-11-11# Description: A more complex function that shows why functions exist.# Usage: ./complex-function.sh###################################### Used to print ...