I have a POSIX-compatible install script which determines the latest version of some software by grepping info from a json blob retrieved from a software registry:
meta=$(wget -qO - https://registry.npmjs.org/after-dark/latest) grep --version | grep "BSD grep" 1>/dev/null && vers=$(echo "$meta" | grep -oE '"version":(\d*?,|.*?[^\\]",)' | tr -d 'version": ,') grep --version | grep "GNU grep" 1>/dev/null && vers=$(echo "$meta" | grep -oP '"version":(\d*?,|.*?[^\\]",)' | tr -d 'version": ,')
I need to make this software compatible with BusyBox, which, like BSD grep, uses
-E for extended regex support. It doesn't, however, support
If I run
busybox grep I see the version of busybox. Should I just use that to add compatibility? Is there a better way I could be doing this to remove the code smell without installing dependencies.