How to define and call functions on Bash Script on Ubuntu 22.04
A shell function is similar to a function in C: It is a sequence of commands that do a single job. Typically, a function is used for an operation that you tend to do frequently in a shell script. Before you can call a function in a shell script, you must define it in the script.
For more explanation on this video: https://www.linuxhelp.com/how-to-define-and-call-functions-on-bash-script-on-ubuntu-22-04
ubuntu