|
|
@@ -7,9 +7,20 @@ I’m coming across having to write the same shell script bits occasionally, and |
|
|
|
- Write once (here) and copypasta everywhere. |
|
|
|
- sh compatible if possible |
|
|
|
|
|
|
|
# Examples |
|
|
|
|
|
|
|
This section shows example usages for common shell patterns. |
|
|
|
|
|
|
|
## Trap errors |
|
|
|
|
|
|
|
[trap_error_example.sh](trap_error_example.sh): If you run a script with -e that produces state that you want to clean up if anything goes wrong in your script. |
|
|
|
|
|
|
|
[trap_exit_example.sh](trap_exit_example.sh): if you run a script that launches other processes, and you want to make sure those processes exit when your script exists. |
|
|
|
|
|
|
|
# Functions |
|
|
|
|
|
|
|
This section documents reusable functions for your scripts. |
|
|
|
|
|
|
|
## `wait_for_url $url $duration $iterations` |
|
|
|
|
|
|
|
Wait for a particular URL to be available using `curl`. Wait `$duration` seconds between attempts, try `$iterations` times. Defaults to `1` seconds and `3` times. |
|
|
|