29 lines
802 B
Markdown
29 lines
802 B
Markdown
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. 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_for_extension ./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
|
|
```
|
|
|