How Do You Troubleshoot “command not found” in a Bash Script?

Problem scenario
You have a function defined in your Bash script.   You call the function you created.  But you get "command not found".  What should you do?

Solution
The Bash script is parsed from the top of the file to the bottom of the file.  You cannot invoke the function before it has been defined.  Place the function above the line where it is called.  The function should probably go near the top despite the lack of readability.

Leave a comment

Your email address will not be published.