When you have collected a few functions that you use regularly you can put them in a function file and load the file into the shell. This method is called sourcing a file or using the dot command.
The file should contain the #!/bin/sh at the top of the file. The file can be called anything you like, but be sure to call it something meaningful to its task, for example ‘ functions.main ’.
Once the file is loaded into the shell, you can call the functions from the command line or your script. To see all your defined functions use the set command. The output will contain all the functions that have been loaded into the shell.
To make changes to any of your functions first use the unset command to delete the function ...