This helper script can be sourced at the top of another Bash script to ensure that
it runs under Bash 4 with GNU grep, readline, sed, and zcat.
It should be sourced in your script like this, before the part of the script that uses Bash 4 features or expects GNU tools:
source .ensure-bash4+gnu-tools.bash "$BASH_SOURCE" "$@"