In the next example, we'll create a script that allows us to print text to our terminals in a few different colors. It does this based on a function that has two parameters: string and color. Take a look at the following commands:
reader@ubuntu:~/scripts/chapter_13$ vim colorful.sh reader@ubuntu:~/scripts/chapter_13$ cat colorful.sh #!/bin/bash###################################### Author: Sebastiaan Tammer# Version: v1.0.0# Date: 2018-11-17# Description: Some printed text, now with colors!# Usage: ./colorful.sh#####################################print_colored() { # Check if the function was called with the correct arguments. if [[ $# -ne 2 ]]; then echo "print_colored needs two arguments, exiting." exit 1 fi # Grab both arguments. ...