Collection of useful bash functions. Every script file includes the function and a test to show how it's meant to be used and check that the function really works. Just executing the script runs that test. ## Check folder for extension Checks a given folder for certain file extensions recursively. All found files with the extension(s) are returned in a global array; New files are appended to the array. The [check_folder_for_extension test folder](cffe_test) contains of 13 files, 12 of them images, which should be found by the test. Function call: ``` check_folder $my_folder $extension_list ``` To test the function call: ``` check_folder_for_extension.sh ./cffe_test "*.jpg *.JPG" ``` For multiple extensions (or other parts of the file name to match) space separate the list, like shown above. ## Clean up Cleaning up in a script and exit with a given exit code. function call: ``` clean_up 0; ``` For testing the function call the script with: ``` clean_up.sh test ``` ## Logger [Logger](logger.sh) to write messages with individual levels to a file. In level *debug* all logged messages are printed to stdout, too. Log levels are 5 LLDebug, *for exceptionally verbose messages, also on std out* 4 LLInfo, *informative messages* 3 LLWarning, *warning messages* 2 LLError, *error messages* 1 LLMdtry and *mandatory messages to get minimal info in a log file* 0 LLMute *really nothing gets written* The higher the level set in `$Log_Level` to the logger, the more verbose it gets. ``` logger $LLWARNING "This is my message"; ``` produces the following message in the log file: ``` logger 20231122_22:43:19 Warning: This is my message! ``` For testing the function call the script with just: ``` logger.sh ```