Big thanks to @edgar-vincent for the big refactor he made!
Main changes:
- Split the script into functions
- Remove redundant code
- Minimise the use of external commands
- Use [[ test ]] instead of [ test ]
- Make the README less verbose and adapt to reflect changes in script
- Add INCLUDE_COUNTRY_CODES and allow multiple values passed to -c
- Allow multiple values passed to -d
- Improve output formatting
- Improve error handling and print errors to stderr
- Add a function to trap SIGINT (which needs to be improved)
Breaking changes:
- EXCLUDE_COUNTRY_CODES is no longer a regular expression (which makes the syntax cleaner, I think).
This requires Bash >=4.4, which shouldn't be a problem since this script targets GNU/Linux.